Getting bearer token for streaming API



I am trying to get a token to access stream api -

For this I’ve created a twitter app and have I have created consumer key and consumer secret. I’m able to invoke and get the oauth_token and oauth_token_secret.

However, I am not able to retrieve the bearer token to invoke the streaming api. When I invoke “” with header params below, I get “access data - { ‘Error processing your OAuth request: Invalid oauth_verifier parameter’: ‘’ }”.

consumer_key: 'key’
consumer_secret: 'secret’
token: auth_data.oauth_token
token_secret: auth_data.oauth_token_secret

How do I retrieve “oauth_verifier” parameter? I’m building this for an automated system which will use the streaming api, without any manual user input.
Is there another approach to invoke streaming apis?


You need bearer tokens for OAuth 2. Twitter uses OAuth 2 for application-only authentication.

statuses/filter requires a user context as stated in the documentation, so you will need to use OAuth 1 along with user access tokens.

You can generate access tokens for the user that owns the app in This removes the need for manual user input through the Twitter Sign-in process. Just be careful to guard those access tokens and not expose them publicly.