Twitter v1 (Deprecated)
X/Twitter(opens in a new tab) considers this method deprecated. We strongly recommend using the latest version (v2) for future-proofing your application.
How to set up social connection with Twitter v1
Overview
Adding social connection with Twitter to your app with Clerk is done in a few steps - you only need to set the Client ID, Client Secret and Authorized redirect URI in your instance settings.
Clerk does not currently support preconfigured shared OAuth credentials for Twitter on development instances. You will have to provide custom credentials for both development and production instances, which includes generating your own Client ID and Client Secret using your Twitter Developer account. Don't worry, this guide will walk you through that process in just a few simple steps.
The purpose of this guide is to help you create a Twitter account and a Twitter OAuth app - if you're looking for step-by-step instructions using Clerk to add social connection (OAuth) to your application, follow the Social connection (OAuth) guide.
Before you start
- You need to create a Clerk Application in your Clerk Dashboard(opens in a new tab). For more information, check out our Set up your application guide.
- You need to have a Twitter Application set up so it can be used for Social connection. If you don't have a Twitter Application, click here(opens in a new tab) for instructions on how to create one. If you already have one, please go to your Twitter app settings(opens in a new tab) and ensure that the "Allow this app to be used to Sign in with Twitter?” option is enabled.
Configuring Twitter social connection
If you don't have an existing Twitter Application you've set up for social connection, you need to register a new one at the Twitter Developer Portal(opens in a new tab). Note that the process requires approval from Twitter before your new application can be used.
To do so, go to "Projects & Apps(opens in a new tab)" and click "+ Add App" to create a new application. After entering a name, you'll be presented with your app's credentials: API Key and API Secret. Copy those values as you will be needing those shortly.
You will need your application to be approved for elevated status to be able to use it with Clerk. You can apply for the status in Twitter developer dashboard(opens in a new tab)
In the Clerk Dashboard, go to User & Authentication > Social Connections(opens in a new tab) and enable Twitter. In the modal that opened, ensure Use custom credentials is enabled and paste the API Key and API Secret values which you copied in the previous step. Then, copy the Authorized redirect URI.
Navigate to your application settings screen and scroll down to the User authentication settings section and click Set up.
In the next screen you'll be presented with the user authentication settings. Make sure that both OAuth 1.0a and Request email address from users are enabled.
Also, enter the Authorized Redirect URI that you grabbed in the previous step from your Clerk instance's settings and insert it in the Callback URI setting. Your app's settings should like similar to the ones below. Fill any other required fields and click save. Your Twitter App is now ready.
Don't forget to click Apply in the Clerk dashboard. Congratulations! Social connection with Twitter is now configured for your instance.