Skip to content

Creating the Client ID, Access Token and Refresh Token

In this documentation, you will learn how to create the Client ID, Access Token and Refresh Token for the Twitter connector using the Twitter developer portal.

For the Twitter connector 3.0.x version, OAuth 2.0 Authorization Code Flow with PKCE is used to authenticate the user. Therefore, obtaining credentials is different from the Twitter connector 2.0.x version as it uses OAuth 1.0a authentication mechanism. For more information about the authentication mechanism, see Twitter OAuth 2 guide.

Steps to follow

  1. To get started with the new Twitter API, you need a developer account. If you do not have one yet, you can sign up for one.

  2. Then log into the developer portal.


The Twitter Free tier subscription is only sufficient for createTweet, deleteTweet, and getMe operations. If you want to use other operations, you need to upgrade your subscription to Basic Tier.

  1. Create a new project and create an app inside the project. New Project

  2. In the app, you will need to set up the OAuth 2.0 as the WSO2 Twitter connector uses this authentication mechanism. OAuth setup

  3. Provide necessary variables. The Access tokens and refresh tokens will be sent to the callback URL. Callback URL

  4. After successfully setting up the user authentication you can obtain the client ID of the Twitter app which is used for the Twitter connector configuration. Client ID

  5. To obtain the Access Token and Refresh Token, follow the Twitter OAuth 2 guide.


The Twitter access token is valid for 2 hours. The refresh token is valid until a new access token is created from the refresh token.


By default the Twitter App provides an access token for OAuth 1.0a flow which is not used in the Twitter connector. You need to create a new access token for OAuth 2.0 flow.