Overview
Configure your own X (formerly Twitter) OAuth application to enable custom branding for the X authentication experience in Embedded Wallets. This guide walks you through creating an X Developer account, configuring an OAuth 2.0 app, and integrating with CDP. Time to complete: ~15-20 minutesX (formerly known as Twitter) rebranded in 2023, but the authentication process is still commonly referred to as “Twitter login” or “X login”.
Prerequisites
Before you begin, ensure you have:- X Developer account: Free tier available at developer.x.com
- CDP Project ID: Available in your CDP Portal dashboard
- Access to CDP Portal: Permission to configure Embedded Wallets settings
Step 1: Create X Developer account
- Navigate to developer.x.com
- Click Sign In and authenticate with your X account
- If you don’t have developer access yet, click Apply for a developer account
-
Complete the developer application:
- What is your primary reason for using the X API?: Select the most appropriate option (e.g., “Building tools for X users”)
- What are you planning to do with the X API?: Describe your application (e.g., “Enable users to authenticate and access web3 wallets using their X account”)
- Will your app use Tweet, Retweet, Like, Follow, or Direct Message functionality?: Select “No” (unless you need these features)
- Complete any additional required fields
- Review and accept the X Developer Agreement
- Click Submit and wait for approval (usually instant for basic access)
Most applications are approved instantly for basic OAuth access. If additional review is required, you’ll receive an email notification.
Step 2: Create X app
- Once your developer account is approved, navigate to the X Developer Portal
- Click + Create Project or + Add App
-
Fill in the app details:
- App name: Your application name (visible to users during OAuth, e.g., “My App”)
- App description: Brief description of your application
- Website URL: Your application’s website
- Callback URL: Leave blank for now (we’ll configure this in Step 3)
- Click Create or Next
Step 3: Configure OAuth 2.0 settings
- In your X app dashboard, navigate to Settings or App settings
- Scroll to User authentication settings section
- Click Set up or Edit
-
Configure OAuth 2.0:
- App permissions: Select Read (minimum required for authentication)
- Type of App: Select Web App
- App info:
- Callback URI / Redirect URL: Enter the exact URL:
- Website URL: Your application’s website URL
- Callback URI / Redirect URL: Enter the exact URL:
- Click Save
-
After saving, you’ll see your OAuth 2.0 credentials:
- Client ID: Copy this value
- Client Secret: Click Generate or Regenerate to create a secret, then copy it
Step 4: Enable OAuth 2.0
Ensure OAuth 2.0 is properly enabled for your app:- In your app settings, verify that OAuth 2.0 is enabled
- Confirm the Read permission is granted (minimum requirement)
- Check that the Callback URI is correctly configured
Additional app permissions (Write, Direct Messages) require X app review. For authentication purposes, Read permission is sufficient.
Step 5: Configure CDP Portal
Now that you have your X OAuth credentials, configure them in the CDP Portal:Configure X OAuth in CDP Portal
Configure X OAuth in CDP Portal
- Navigate to the CDP Portal
- Select your project
- Go to Embedded Wallets > Authentication
- Find the X section
- Toggle Enable X OAuth to on
- Paste your Client ID from Step 3
- Paste your Client Secret from Step 3
- Click Save Changes
Step 6: Verification
Test your X OAuth configuration:- In your application, ensure you’re calling the X sign-in method (see SDK Integration below)
- Click “Sign in with X”
- Verify that the OAuth consent screen shows your application name
- Complete the authentication flow
- Check that the user successfully signs in and their wallet is accessible
During testing, you can use any X account to authenticate. Unlike some providers, X doesn’t require adding test users during development.
SDK Integration
Integrate X authentication in your application using CDP’s SDK:The SDK automatically uses your custom X OAuth configuration when available. No code changes are needed when switching from CDP’s default to your custom OAuth application.
Production considerations
Rate limits and quotas
Rate limits and quotas
X imposes strict rate limits on OAuth and API requests:Free tier limits:
- OAuth requests: Limited number of authentication requests per 15-minute window
- User lookup: Limited API calls for fetching user information
- Monthly caps: Overall monthly limits on API usage
- Monitor usage: Track your OAuth request volume in X Developer Portal
- Upgrade tiers: Consider X API Pro or Enterprise for higher limits
- Rate limit handling: Implement proper error handling for rate limit responses (HTTP 429)
- Caching: Cache user information to minimize API calls
- Navigate to X Developer Portal
- Go to your app settings
- Look for “Request rate limit increase” or contact X support
- Provide justification and expected usage patterns
App review and permissions
App review and permissions
Basic OAuth authentication only requires Read permission, which doesn’t require app review. However:
- Additional permissions: Write, Direct Messages, or other advanced permissions require X app review
- Review process: Can take several days to weeks
- Elevated access: Some features require X API Pro or Enterprise subscription
Branding and user experience
Branding and user experience
Ensure your X OAuth experience reflects your brand:
- App name: Update to your official product name in app settings
- App icon: Upload your logo in app settings (shown during OAuth flow)
- App description: Keep concise and clear about what users are authenticating for
- Website URL: Link to your main product page
Security and credentials
Security and credentials
- Client Secret: Store securely (environment variables, secrets manager)
- Rotation: Regenerate Client Secret periodically for security
- Access control: Limit who can access your X Developer Portal account
- Monitoring: Enable notifications for unusual app activity
- Scopes: Only request minimum required permissions (Read for authentication)
Troubleshooting
Error: Callback URL mismatch
Error: Callback URL mismatch
Cause: The Callback URI in your X app configuration doesn’t match the redirect URL.Solution:
- In X Developer Portal, go to your app’s User authentication settings
- Verify the Callback URI exactly matches:
https://api.cdp.coinbase.com/platform/v2/end-users/auth/oauth/x/callback - Check for trailing slashes, http vs https, and typos
- Save changes in X Developer Portal (may take a few minutes to propagate)
- Try authentication again
Error: Invalid client credentials
Error: Invalid client credentials
Cause: The Client ID or Client Secret is incorrect or has been regenerated.Solution:
- Verify the Client ID in CDP Portal matches the one in X Developer Portal
- Verify the Client Secret in CDP Portal matches the current secret
- If you regenerated the Client Secret, update it in CDP Portal
- Ensure no extra spaces or characters were copied
- Check that the credentials are from the correct X app
Error: App not approved / insufficient permissions
Error: App not approved / insufficient permissions
Cause: Your app requires permissions that need X review, or the app hasn’t been approved.Solution:
- Verify you only selected Read permission (doesn’t require review)
- If you need additional permissions, submit your app for X review
- Check X Developer Portal for any pending review requirements
- Ensure your X Developer account is in good standing
- Contact X support if approval is taking longer than expected
Error: Rate limit exceeded (429)
Error: Rate limit exceeded (429)
Cause: You’ve exceeded X’s rate limits for OAuth requests.Solution:
- Implement exponential backoff retry logic in your application
- Cache user authentication states to reduce OAuth requests
- Monitor your usage in X Developer Portal
- Consider upgrading to X API Pro for higher limits
- Spread authentication requests over time if doing bulk testing
User sees authorization error
User sees authorization error
Authentication works but wallet doesn't load
Authentication works but wallet doesn't load
Cause: This is likely an issue with your CDP configuration, not X OAuth.Solution:
- Check CDP status page for potential outages
- Verify your CDP Project ID is correct in your application
- Ensure you’re using the latest SDK version
- Check that the user’s X username/ID is being properly passed to CDP
- Contact CDP support if the issue persists