edit on github

How to get Twitter API tokens

October 15, 2015

It maybe seems that start playing with Twitter API can be hard to start, but actually it’s not. First of all, you need to get tokens, to start. And this process is very easy.

  1. Go to "Create new Twitter App" form.
  2. Fill it. Callback URL is not required.
    filled form
  3. Agree to "Developer Agreement", submit form.
  4. Go to "Keys and Access Tokens" tab
    "Keys and Access Tokens" tab
  5. At the bottom, you will find empty "Your Access Token" with "Create my access token" button, go ahead and click it.
    "Your Access Token"
  6. Click "Test OAuth" button in the top right corner.
    "Test OAuth"

Tokens are "Consumer Key", "Consumer Secret" and "Access Token" with "Access Token Secret":
app tokens in one place
or TWITTER_CONSUMER_KEY, TWITTER_CONSUMER_SECRET and TWITTER_ACCESS_TOKEN_KEY, TWITTER_ACCESS_TOKEN_SECRET if you will use them as environment variables.

Congratulations, you have Twitter API tokens.

Be careful with them. Pay attention to small gray warning on the page:

Keep the "Consumer Secret" a secret. This key should never be human-readable in your application.

and

This access token can be used to make API requests on your own account's behalf. Do not share your access token secret with anyone.

Don’t commit it in your repo. Use environment variables instead.

140 symbols ought to be enough for anybody,
your Vladimir Starkov