> ## Documentation Index
> Fetch the complete documentation index at: https://www.anything.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Login with X (Twitter)

> Let users sign in to your app with their X/Twitter account

Let users sign in to your app with their X/Twitter accounts. They'll share their username, name, profile picture, and email.

You'll need to set up a few things in X first, then add those settings to Anything.

## Before you start

Make sure you have:

<Check>
  An Anything project with [User Accounts](/apps/auth) turned on
</Check>

<Check>
  Your app running on a custom domain through [Anything's domain setup](/launch/domains)
</Check>

## Overview

<CardGroup cols={2}>
  <Card title="Set Up an X App" icon="key">
    Create an app in X
  </Card>

  <Card title="Add to Anything" icon="plug">
    Add credentials to Anything
  </Card>

  <Card title="Add sign-in UI" icon="pencil">
    Customize the login button
  </Card>

  <Card title="Test flow" icon="check-circle">
    Make sure login works
  </Card>
</CardGroup>

## X Setup

<div style={{ position: 'relative', paddingBottom: '56.25%', height: 0, overflow: 'hidden' }}>
  <iframe style={{ position: 'absolute', top: 0, left: 0, width: '100%', height: '100%' }} src="https://www.loom.com/embed/9e22bc2239614b0daa57d62d1a0f5977?sid=35c1933c-dfe0-430c-913f-26863d44dbf1" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen />
</div>

<Steps>
  <Step title="Access X Developer Portal">
    1. Go to [X Developer Portal](https://developer.x.com/en/apps)

    2. Sign in with your X account

    3. Click "Create an App"

    <img src="https://mintcdn.com/create/Gl2O6oYpcGusVDs1/images/auth/x/1-developerxapps.png?fit=max&auto=format&n=Gl2O6oYpcGusVDs1&q=85&s=02bb31951982beaf7f08f181bd83ed2c" width="3456" height="2080" data-path="images/auth/x/1-developerxapps.png" />
  </Step>

  <Step title="Apply for Developer Account">
    1. If you don't have a developer account, you'll need to apply

    2. Fill out the required information about your use case

    3. Submit your application

    <img src="https://mintcdn.com/create/Gl2O6oYpcGusVDs1/images/auth/x/2-applyfordevaccount.png?fit=max&auto=format&n=Gl2O6oYpcGusVDs1&q=85&s=b1e0819f2cc697fd0a0e5e032da842e8" style={{ borderRadius: '0.5rem' }} width="3456" height="2078" data-path="images/auth/x/2-applyfordevaccount.png" />
  </Step>

  <Step title="Choose Developer Plan">
    1. Review the available developer plans

    2. You can sign up for a Free account if you prefer

    3. Select your plan and continue

    <img src="https://mintcdn.com/create/Gl2O6oYpcGusVDs1/images/auth/x/3-chooseplan.png?fit=max&auto=format&n=Gl2O6oYpcGusVDs1&q=85&s=31b92edb0bd3b7d238a580c60bb74b82" style={{ borderRadius: '0.5rem' }} width="3456" height="2082" data-path="images/auth/x/3-chooseplan.png" />
  </Step>

  <Step title="Accept Developer Agreement">
    1. Review the developer terms

    2. Describe your app's purpose and that you're using Login with X

    3. Accept the terms to proceed

    <img src="https://mintcdn.com/create/Gl2O6oYpcGusVDs1/images/auth/x/4-acceptagreement.png?fit=max&auto=format&n=Gl2O6oYpcGusVDs1&q=85&s=95fee9c0560c10fa192512bf40f1e10b" style={{ borderRadius: '0.5rem' }} width="3456" height="1984" data-path="images/auth/x/4-acceptagreement.png" />
  </Step>

  <Step title="Create Project">
    1. Once approved, navigate to your dashboard

    2. Click "Create Project" to begin

    <img src="https://mintcdn.com/create/Gl2O6oYpcGusVDs1/images/auth/x/5-createproject.png?fit=max&auto=format&n=Gl2O6oYpcGusVDs1&q=85&s=9fb44c9d50334ff64a3e65eaf42c0273" style={{ borderRadius: '0.5rem' }} width="3456" height="2078" data-path="images/auth/x/5-createproject.png" />
  </Step>

  <Step title="Name Your Project">
    1. Choose a descriptive name for your project

    2. This is for internal organization

    3. Click continue

    <img src="https://mintcdn.com/create/Gl2O6oYpcGusVDs1/images/auth/x/6-chooseaname.png?fit=max&auto=format&n=Gl2O6oYpcGusVDs1&q=85&s=9fcfd506f649860dc4c3bf57f03a9755" style={{ borderRadius: '0.5rem' }} width="3456" height="2078" data-path="images/auth/x/6-chooseaname.png" />
  </Step>

  <Step title="Select Use Case">
    1. Choose the primary use case for your app

    2. This helps X understand how you'll use their API

    <img src="https://mintcdn.com/create/Gl2O6oYpcGusVDs1/images/auth/x/7-chooseusecase.png?fit=max&auto=format&n=Gl2O6oYpcGusVDs1&q=85&s=b3586ae2b154eeae9413ba98f9c9a527" style={{ borderRadius: '0.5rem' }} width="3456" height="2076" data-path="images/auth/x/7-chooseusecase.png" />
  </Step>

  <Step title="Add Project Description">
    1. Provide a detailed description of your project

    2. Explain how you'll use X's features

    3. Be specific about your Login with X implementation

    <img src="https://mintcdn.com/create/FQ38N__i9RkapQvc/images/auth/x/8-projectdescription.png?fit=max&auto=format&n=FQ38N__i9RkapQvc&q=85&s=2b05e8002ceb051d7667349c187d734e" style={{ borderRadius: '0.5rem' }} width="3456" height="2078" data-path="images/auth/x/8-projectdescription.png" />
  </Step>

  <Step title="Name Your App">
    1. Choose a user-facing name for your app

    2. This will be visible to users during sign in

    <img src="https://mintcdn.com/create/FQ38N__i9RkapQvc/images/auth/x/9-nameapp.png?fit=max&auto=format&n=FQ38N__i9RkapQvc&q=85&s=c8f0910a26bbba46b11fb46d1f6d8649" style={{ borderRadius: '0.5rem' }} width="3456" height="2082" data-path="images/auth/x/9-nameapp.png" />
  </Step>

  <Step title="Skip Initial Tokens">
    1. You'll see initial Keys & Tokens

    2. These include API Key, API Key Secret, and Bearer Token

    3. You can skip these for now - click "App Settings"

    <img src="https://mintcdn.com/create/Gl2O6oYpcGusVDs1/images/auth/x/10-skiptokens.png?fit=max&auto=format&n=Gl2O6oYpcGusVDs1&q=85&s=61d88f6c0dacd20fb34a3d5c887354cd" style={{ borderRadius: '0.5rem' }} width="3456" height="2078" data-path="images/auth/x/10-skiptokens.png" />
  </Step>

  <Step title="Configure User Authentication">
    1. In App Settings, find "User authentication settings"

    2. Click "Set up"

    <img src="https://mintcdn.com/create/Gl2O6oYpcGusVDs1/images/auth/x/11-userauthenticationsetup.png?fit=max&auto=format&n=Gl2O6oYpcGusVDs1&q=85&s=32e2d6c81ff8adf4c1a31ac31be9a8f3" style={{ borderRadius: '0.5rem' }} width="3456" height="2078" data-path="images/auth/x/11-userauthenticationsetup.png" />
  </Step>

  <Step title="Set App Permissions">
    1. Choose your app permissions level

    2. You can request read/write permissions

    3. Optionally request email access for users if you want your app to send users emails

    <img src="https://mintcdn.com/create/Gl2O6oYpcGusVDs1/images/auth/x/12-apppermissions.png?fit=max&auto=format&n=Gl2O6oYpcGusVDs1&q=85&s=998668f05228a0fa919e265c4d6e83bf" style={{ borderRadius: '0.5rem' }} width="3456" height="2078" data-path="images/auth/x/12-apppermissions.png" />
  </Step>

  <Step title="Configure App Type">
    1. Select "Web App" as your app type

    2. This enables web-based authentication

    <img src="https://mintcdn.com/create/Gl2O6oYpcGusVDs1/images/auth/x/13-webapp.png?fit=max&auto=format&n=Gl2O6oYpcGusVDs1&q=85&s=11da48c5ed0166bb8dce97a9f7aaf7d2" style={{ borderRadius: '0.5rem' }} width="3456" height="2074" data-path="images/auth/x/13-webapp.png" />
  </Step>

  <Step title="Add App Information">
    1. Enter your callback URL:
       `https://www.your-domain.com/api/auth/callback/twitter`

    2. Add your website URL:
       `https://www.your-domain.com`

    3. Add privacy policy URL:
       `https://your-domain.com/privacy`

    4. Add terms of service URL:
       `https://your-domain.com/terms`

    <img src="https://mintcdn.com/create/Gl2O6oYpcGusVDs1/images/auth/x/14-redirecturlappinfo.png?fit=max&auto=format&n=Gl2O6oYpcGusVDs1&q=85&s=844c053728f97b545b802ef250f04dff" style={{ borderRadius: '0.5rem' }} width="3456" height="2076" data-path="images/auth/x/14-redirecturlappinfo.png" />

    <Warning>
      Must include:

      * `https://` protocol

      * `www` prefix for callback and website URLs

      * Exact domain for the app used in Anything's custom domain settings
    </Warning>

    <Tip>
      You can use services like Termly to generate these required policy documents and host them on pages in your Anything app
    </Tip>
  </Step>

  <Step title="Access Keys and Tokens">
    1. After saving settings, go to "Keys and Tokens" section

    <img src="https://mintcdn.com/create/Gl2O6oYpcGusVDs1/images/auth/x/15-keysandtokens.png?fit=max&auto=format&n=Gl2O6oYpcGusVDs1&q=85&s=32e36b64a0dbbf147049eb7bd70dbc13" style={{ borderRadius: '0.5rem' }} width="3456" height="2080" data-path="images/auth/x/15-keysandtokens.png" />
  </Step>

  <Step title="Copy OAuth Credentials">
    1. Under OAuth 2.0 Client ID and Client Secret

    2. Copy the Client ID

    3. Generate and copy the Client Secret

    4. Save both values - you'll need them in Anything

    <img src="https://mintcdn.com/create/Gl2O6oYpcGusVDs1/images/auth/x/16-clientidclientsecret.png?fit=max&auto=format&n=Gl2O6oYpcGusVDs1&q=85&s=2a84b66fa9326e6528fa23c41d424ca5" style={{ borderRadius: '0.5rem' }} width="3456" height="2080" data-path="images/auth/x/16-clientidclientsecret.png" />

    <Warning>
      Keep your Client Secret secure - never share it publicly
    </Warning>
  </Step>
</Steps>

## Add to Anything project

<Steps>
  <Step title="Enable User Accounts">
    You have two options:

    1. Prompt Anything with "Let users sign in"

    2. Enable User Accounts from the logo menu
  </Step>

  <Step title="Access Project Settings">
    1. Click the 3-dot menu at the top of the chat

    2. Select "Project Settings"

    <img src="https://mintcdn.com/create/Gl2O6oYpcGusVDs1/images/auth/x/17-createprojectsettings.png?fit=max&auto=format&n=Gl2O6oYpcGusVDs1&q=85&s=1de878b5c2f0f5729d59527d3ce92c05" style={{ borderRadius: '0.5rem' }} width="3456" height="2078" data-path="images/auth/x/17-createprojectsettings.png" />
  </Step>

  <Step title="Enable Login with X">
    1. Navigate to the Authentication section

    2. Find Login with X toggle

    3. Turn it on

    <img src="https://mintcdn.com/create/Gl2O6oYpcGusVDs1/images/auth/x/18-enabletwitter.png?fit=max&auto=format&n=Gl2O6oYpcGusVDs1&q=85&s=cbcb91f1d49513fdc4960788a8b21818" style={{ borderRadius: '0.5rem' }} width="3456" height="2080" data-path="images/auth/x/18-enabletwitter.png" />
  </Step>

  <Step title="Add X Credentials">
    1. Paste in your Client ID

    2. Paste in your Client Secret

    3. Click Save

    <img src="https://mintcdn.com/create/Gl2O6oYpcGusVDs1/images/auth/x/18-enabletwitter.png?fit=max&auto=format&n=Gl2O6oYpcGusVDs1&q=85&s=cbcb91f1d49513fdc4960788a8b21818" style={{ borderRadius: '0.5rem' }} width="3456" height="2080" data-path="images/auth/x/18-enabletwitter.png" />
  </Step>

  <Step title="Add Sign In UI">
    1. Return to the chat

    2. Prompt Anything with "Add Login with X as an option"

    3. Anything will update your sign-in pages automatically

    <img src="https://mintcdn.com/create/Gl2O6oYpcGusVDs1/images/auth/x/19-promptcreate.png?fit=max&auto=format&n=Gl2O6oYpcGusVDs1&q=85&s=5b734958a13ff62886175075596e690b" style={{ borderRadius: '0.5rem' }} width="3456" height="2078" data-path="images/auth/x/19-promptcreate.png" />
  </Step>

  <Step title="Publish Your App">
    1. Click the Publish button

    2. Review your changes

    3. Publish to make the Login with X feature live
  </Step>
</Steps>

## Testing

1. Publish your changes

2. Open your app in a new incognito window

3. Go to the sign in page

4. Try signing in with X

5. Check the [auth\_users table](/apps/databases) to see your new user

## Troubleshooting

<Accordion title="Can't see the X button">
  * Check if User Accounts is turned on

  * Make sure Login with X is enabled in Project Settings

  * Prompt Anything with "Add Login with X as an option to the sign in page"

  * Try publishing your changes again

  * Clear your browser data and try in incognito mode
</Accordion>

<Accordion title="Login not working">
  * Double check your domain is exactly the same in Anything and X

  * Make sure your callback URL is right: `www.[your-domain].com/api/auth/callback/twitter`

  * Check if your Client ID and Secret are pasted correctly

  * Make sure OAuth 2.0 is turned on in X

  * Make sure your app is live at your custom domain
</Accordion>

<Accordion title="Users can't sign in after domain change">
  * Update the callback URLs in X Developer Portal

  * Update your website URL in X app settings

  * Re-publish your app on the new domain
</Accordion>

## FAQ

<Accordion title="What user info do I get?">
  By default:

  * Username

  * Display name

  * Profile picture (if they have one)

  Additional information requires requesting extra permissions and may require X app review.
</Accordion>

<Accordion title="Can I change how the login button looks?">
  Yes! Just:

  1. Go back to chat

  2. Tell Anything how you want it to look

  3. Anything will help style it while following X's rules
</Accordion>

<Accordion title="Do I need X to review my app?">
  * For basic login: No

  * For extra features: Yes

  * You'll need to submit your app to X for approval
</Accordion>

## See Also

* [User Accounts](/apps/auth)

* [Customizing Login Pages](/apps/auth#customizing-auth-pages)
