How to automate Application-only OAuth for Streaming APIs?


#1

For Search API, things were rather simple:

  1. I simply obtain the access_token from OAuth (https://api.twitter.com/oauth2/token) by supplying the consumer_key and consumer_secret in the header through “Authorization: Basic” format

  2. I perform the Search API (https://api.twitter.com/1.1/search/tweets.json) and supply the access token in the header through “Authorization: Bearer” format

This procedure doesn’t seem to work in Streaming API (https://stream.twitter.com/1.1/statuses/filter.json). I get a 401 Unauthorized error.

The only procedure that worked is to get the signature via OAuth tool and manually execute the curl command.

How do I automate this procedure without having to go to the website (https://dev.twitter.com/oauth/tools/signature-generator) to manually press the Get Signature button?

Thanks in advance!