Getting new Twitter API consumer and secret keys

I am working on a Twitter project where I want to use OAuth but I don't know where to get the consumer and secret keys.

How can I get these?


To get Consumer Key & Consumer Secret, you have to create an app in Twitter via

https://developer.twitter.com/en/apps

Then you'll be taken to a page containing Consumer Key & Consumer Secret.

Hopefully this information will clarify OAuth essentials for Twitter:

  1. Create a Twitter account if you don't already have one
  2. Visit 'https://apps.twitter.com' and follow the required prompts to create a developer project (Twitter requires you to answer some questions before they will approve your account. Approval was nearly instant in my case.)
  3. Requesting the API key and secret via the Developer Portal causes Twitter to produce the following three things:
  • API key (this is your 'consumer key')
  • API secret key (this is your 'consumer secret')
  • Bearer token
  1. Next, visit the 'Authentication Tokens' area of the Developer Portal and generate an 'Access token & secret'. This will provide you with the following two items:
  • Access token (this is your 'token key')
  • Access token secret (this is your 'token secret')
  1. The consumer key, consumer secret, token key, and token secret should be sufficient to do Twitter API calls (they were for me). Good luck!

  1. Log into the Twitter Developers section.

    • If you don't already have an account, you can login with your normal Twitter credentials
  2. Go to "Create an app"

  3. Fill in the details of the application you'll be using to connect with the API

    • Your application name must be unique. If someone else is already using it, you won't be able to register your application until you can think of something that isn't being used.
  4. Click on Create your Twitter application

  5. Details of your new app will be shown along with your consumer key and consumer secret.

  6. If you need access tokens, scroll down and click Create my access token

    • The page will then refresh on the "Details" tab with your new access tokens. You can recreate these at any time if you need to.

By default your apps will be granted for read-only access. To change this, go to the Settings tab and change the access level required in the "Application Type" section.

Existing apps

To get the consumer and access tokens for an existing application, go to My applications (which is available from the menu in the upper-right).