Skip to content

Instantly share code, notes, and snippets.

@khlbrg
Created August 30, 2017 08:01
Show Gist options
  • Save khlbrg/d936a2d4671cc97e4a1995aec9b4ac83 to your computer and use it in GitHub Desktop.
Save khlbrg/d936a2d4671cc97e4a1995aec9b4ac83 to your computer and use it in GitHub Desktop.
Create app tokens for facebook and Twitter

Create a new bearer token for Twitter

Using an "application only" token: https://dev.twitter.com/oauth/application-only

  1. Log in to @twitter_account twitter account
  2. Goto https://apps.twitter.com/
  3. Create a new app
  4. Get the consumer key and consumer secret
  5. Generate a bearer token with CURL: curl -u "CONSUMER_KEY:CONSUMER_SECRET" --data 'grant_type=client_credentials' 'https://api.twitter.com/oauth2/token'

Request bearer token

URL: https://api.twitter.com/oauth2/token
Method: POST
Header: Content-Type: application/x-www-form-urlencoded;charset=UTF-8
Header: Authorization: Basic base64("CONSUMER_KEY:CONSUMER_SECRET")
Body: grant_type=client_credentials

Create a new bearer token for Facebook

  1. Log into facebook
  2. Create a new app
  3. Retrieve app key and secret
  4. Generate a bearer token

URL: https://graph.facebook.com/oauth/access_token?client_id={app-id}&client_secret={app-secret}&grant_type=client_credentials
Method: GET

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment