Login with X (Twitter) - Anything

Before you start

Make sure you have:

Overview

Set Up an X App

Create an app in X

Add to Anything

Add credentials to Anything

Add sign-in UI

Customize the login button

Test flow

Make sure login works

X Setup

X/Twitter: Setting up your app in your developer account + obtaining your keys

  1. Access X Developer Portal

    1. Go to X Developer Portal
    2. Sign in with your X account
    3. Click “Create an App”
  2. 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
  3. 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
  4. 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
  5. Create Project

    1. Once approved, navigate to your dashboard
    2. Click “Create Project” to begin
  6. Name Your Project

    1. Choose a descriptive name for your project
    2. This is for internal organization
    3. Click continue
  7. Select Use Case

    1. Choose the primary use case for your app
    2. This helps X understand how you’ll use their API
  8. 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
  9. Name Your App

    1. Choose a user-facing name for your app
    2. This will be visible to users during sign in
  10. 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”
  11. Configure User Authentication

    1. In App Settings, find “User authentication settings”
    2. Click “Set up”
  12. 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
  13. Configure App Type

    1. Select “Web App” as your app type
    2. This enables web-based authentication
  14. 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

Must include:

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

  1. Access Keys and Tokens

    1. After saving settings, go to “Keys and Tokens” section
  2. 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

Keep your Client Secret secure - never share it publicly

Add to Anything project

  1. Enable User Accounts You have two options:

    1. Prompt Anything with “Let users sign in”
    2. Enable User Accounts from the logo menu
  2. Access Project Settings

    1. Click the 3-dot menu at the top of the chat
    2. Select “Project Settings”
  3. Enable Login with X

    1. Navigate to the Authentication section
    2. Find Login with X toggle
    3. Turn it on
  4. Add X Credentials

    1. Paste in your Client ID
    2. Paste in your Client Secret
    3. Click Save
  5. 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
  6. Publish Your App

    1. Click the Publish button
    2. Review your changes
    3. Publish to make the Login with X feature live

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 to see your new user

Troubleshooting

Can't see the X button

Login not working

Users can't sign in after domain change

FAQ

What user info do I get?

By default:

Additional information requires requesting extra permissions and may require X app review.

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

Do I need X to review my app?