Skip to main content
Version: v0.15

Twitter

In this tutorial, we will learn how to set up Twitter as an authentication provider for Conduit.

Prerequisites

Before you begin, you will need to have a Twitter account and a Twitter app. If you don't have a Twitter account, you can create one here.
If you don't have a Twitter app, you can create one here.

Setting up Twitter

Step 1: Create a Twitter app

  1. Go to the Twitter Developer Portal and log in with your Twitter account.
  2. Click on the Create an app button.
  3. Fill in the required details and click on the Create button.

Step 2: Configure the Twitter app

  1. Go to the Keys and tokens tab and copy the API key and API secret key.
  2. Go to the Settings tab and enable Allow this application to be used to Sign in with Twitter.
  3. Go to the App permissions tab and enable the permissions you want to use.

Step 3: Configure the Twitter provider

  1. Go to the Authentication tab and click on the SIGN IN METHODS.
  2. Select Twitter from the list of providers.
  3. Paste the API key and API secret key from the Keys and tokens tab of the Twitter app.
  4. Enable the twitter provider and click on the Save button.

Authenticate with Twitter

To begin authenticating with Twitter you request a redirect url with the proper scopes

Request
curl --location --request GET 'http://localhost:3000/authentication/init/twitter'
Response
{
"result": "https://twitter.com/i/oauth2/authorize?client_id=ZURSUXNqX2Q5T1RmcDNCenJBZE46MTpjaQ&redirect_uri=http://localhost:3000/hook/authentication/twitter&response_type=code&response_mode=query&scope=tweet.read%20users.read%20offline.access&code_challenge=LBVjPhkdXdFvZZdn3OvsyvwZAQRrr05-N_oprH3EBWo&code_challenge_method=S256&state=006f65b0-a26c-4a69-aa29-6145d8506cc6"
}

Open a browser and navigate to the url returned to you from Conduit. Now the /hook/authentication route has been triggered. Once your browser has been redirected, your authentication has been completed.