Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joshed-io/twitter-stream-proxy
A simple node.js twitter streaming API proxy that returns tweets for tokens
https://github.com/joshed-io/twitter-stream-proxy
Last synced: 13 days ago
JSON representation
A simple node.js twitter streaming API proxy that returns tweets for tokens
- Host: GitHub
- URL: https://github.com/joshed-io/twitter-stream-proxy
- Owner: joshed-io
- License: mit
- Created: 2012-12-22T05:11:11.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2012-12-24T11:56:31.000Z (almost 12 years ago)
- Last Synced: 2024-04-18T01:42:42.870Z (7 months ago)
- Language: JavaScript
- Size: 121 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# twitter-stream-proxy
A simply utility for proxying the Twitter Streaming API for multiple access tokens.
### Requirements
A registered Twitter app, and the CONSUMER_KEY and CONSUMER_SECRET
environment variables properly set. Because you'll need to set those variables,
run this only on a trusted server.Set the ALLOWED_ORIGINS environment variable. This determines what hosts can
connect to your proxy server. For local development,
you might set a value of `localhost:*`. When you deploy, make sure
to include the correct value in your environment.The client making the socket connection must provide a valid
OAuth access token and OAuth access token secret, created by the Twitter app
you've specified in the environment.The result: the access token and secret are combined with the app-level credentials
to create the correct signature.### Usage
Deploy to any node.js hosting environment of your choice. Make sure to
set the environment variables in that environment. Point your clients to the hosted URL.### Possible uses
The Twitter streaming API can't be accessed directly in the browser (AFAIK). A proxy server
is needed, and often times a streaming API developer's application server doubles as the proxy server.For apps without a server, this doesn't work. Such apps may authenticate purely in the browser using
services like Firebase paired with Singly. The browser session then has the Twitter tokens or, in the
Singly case, can look up the Twitter tokens using the Singly token.Once the Twitter per-user OAuth token & secret are known, the browser can send them to a
trusted server w/ the app credentials, and the server will have the requisitie data to
form a signature and connect to the API.### Caveats
This probably isn't for production usage. I'm using it in a fun side project.
If you plan to use it in production, there are probably terms of service and
security issues that you'll want to think through first. And you'd definitely
want to use SSL for the socket connection since you're passing tokens.### License
See license file.