Skip to content

How To Setup X/Twitter

Step 1: Create a Twitter Developer Account

  1. Go to the Twitter Developer Platform website.
  2. Sign in or create a new account.
  3. Navigate to the Developer Dashboard.

Step 2: Create a New Twitter App

  1. Click on the “Projects & Apps” tab.
  2. Click on “Create App.”
  3. Fill in the required information.
  4. Accept the Developer Agreement and click “Create.”

Step 3: Obtain API Keys and Tokens

keys and tokens

  1. Go to the “Keys and tokens” tab.
  2. Find your “Consumer Keys” (API key and API secret key).
  3. Generate Access token and Access token secret.
  4. Copy and save those values, you can not see them again on the page.

Step 4: Setup “User authentication settings”

This settings are the ones that the user will be see when asked to allow your app to login with X

keys and tokens

  1. In the app Settings page, edit the “User authentication set up”
  2. Set “App Permissions” to “Read” (unless you need to write too)
  3. Set “Type of App” to “Native”
  4. Fill App info, in the Callback URI set something like “yourappname://twitter”
  5. Fill the other required fields and save

Step 4: Integrate Twitter API with Login Module

Get the Login Module and enable the X Login in the config phase:

GetIt.instance.registerSingleton<Auth>(
Auth(
xLoginEnabled: true,
xAuthParams: XAuthParams(
apiKey: "<api key>",
apiSecretKey: "<api secret>",
redirectURI: "<callback uri>",
)
),
);