Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Twitter auth

Easy Twitter API OAuth 2 Access

  1. Go to your applications. Create a new one, and find the values in the Consumer Key and Consumer Secret fields.

  2. Use OAuth client information to produce an OAuth 2 access token:

    curl -i --user <consumer_key>:<consumer_secret> -X POST https://api.twitter.com/oauth2/token -d "grant_type=client_credentials"
    
    {"access_token":"<oauth2_token>","token_type":"bearer"}% 
    
  3. Then use that access token for direct API access:

    curl -i -H "Authorization: Bearer <oauth2_token>" https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name\=<screen_name>
    
    [...]
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.