X (Twitter)
This guide explains how to set up X (formerly Twitter) as an authentication provider with Stack Auth. X OAuth 2.0 allows users to sign in to your application using their X account.
Integration Steps
Create an X Developer Account and Project
- Log in to the X Developer Portal.
- Navigate to the Developer Portal Dashboard.
- Click on + Create Project to create a new project.
- Enter a name for your project and select Web App, Automated App or Bot as the use case, then click Next.
- Enter a description for your project and click Next.
- Name your app and click Next.
- In the App settings section, find your API Key and Secret. These will serve as your OAuth 2.0 Client ID and Client Secret.
- In the left sidebar, click on your project, then select the app you just created.
- Click on the Settings tab and scroll to the User authentication settings.
- Click Set up or Edit if already configured.
- Enable OAuth 2.0 and set the following details:
- Type of App: Web App
- Callback URL / Redirect URL:
https://api.stack-auth.com/api/latest/auth/oauth/callback/x
- Website URL: Your website's URL
- Under App permissions, select your scopes.
- Click Save to apply your changes.
Enable X OAuth in Stack Auth
- On the Stack Auth dashboard, select Auth Methods in the left sidebar.
- Click Add SSO Providers and select X (Twitter) as the provider.
- Set the Client ID (your API Key) and Client Secret you obtained from the X Developer Portal earlier.
Need More Help?
- Check the X OAuth 2.0 documentation
- Join our Discord