Twitter APIs handle enormous amounts of data. The way we ensure this data is secured for developers and users alike is through authentication. There are a few methods for authentication, each listed below.

Most developers will not need to work with the details of authentication as Twitter client libraries already implement the protocol. Supported libraries >

 

Authentication methods

OAuth 1.0a

OAuth 1.0a

OAuth 1.0a allows an authorized Twitter developer app to access private account information or perform a Twitter action on behalf of a Twitter account.

OAuth 2.0 Bearer Token

OAuth 2.0 Bearer Token

OAuth 2.0 Bearer Token allows a Twitter developer app to access information publicly available on Twitter.

Basic authentication

Basic authentication

Many of Twitter’s enterprise APIs require the use of HTTP Basic Authentication.

 

When to use

The most common methods used by the Twitter Developer Platform are OAuth 1.0a and OAuth 2.0 Bearer Token. The best place to check the authentication method required for an endpoint is the API reference page.

Some differences between OAuth 1.0a and OAuth 2.0 Bearer Token methods are:

 

Use case OAuth 1.0a OAuth 2.0 Bearer Token
Search Tweets
Pull user timelines
Get trends data
Post, like, or Retweet a Tweet  
Retrieve a users' email address  
Read or write advertiser data  

 

Required keys and tokens

Consumer API Keys
+
Access Token & Access Token Secret
Bearer Token
Rate Limits Distinct per User and sometimes Twitter developer app Distinct per Twitter developer App

Please note

Your app's Consumer API Keys and Bearer Token, as well as your personal Access Token and Access Token Secret can be obtained from the Twitter developer apps section found in the developer portal. To generate access tokens for a different user, you will need to use the 3-legged OAuth process.

 

Additional resources

Guides

Guides

Learn how to generate tokens and authenticate requests using our integration guides.

API reference

API reference

Review our reference guides for our authentication endpoints.

Protect yourself

Protect yourself

Make sure you understand the best practices for storing your keys and tokens.

Question?

Question?

Visit our FAQs.