Twitter (X) Authentication Guide¶
Twitter (X) Authentication enables publishers to register and log in using their X credentials. This integration leverages the X Developer Platform to provide a secure, identity-driven authentication flow.
🛠️ X Developer Portal Setup¶
Follow these steps to create an application and configure User Authentication settings.
1. Create an X Developer Account¶
- Visit the X Developer Portal and register for an account if you haven't already.
- Navigate to your Dashboard → Projects & Apps.
- Create a new Project (e.g.,
Preads-Auth) and then add a new App.
2. Configure User Authentication¶
- Select your App from the sidebar and click Settings.
- Scroll to User authentication settings and click Edit.
- App permissions: Select Read (standard for login).
- Type of App: Select Web App, Automated App or Bot.
- App Info:
- Callback URI / Redirect URL: Add your callback URL.
- Format:
https://your-domain.com/auth/social/twitter/callback
- Format:
- Website URL:
https://your-domain.com
- Callback URI / Redirect URL: Add your callback URL.
- Click Save.
3. Retrieve API Credentials¶
- Click the Keys and Tokens tab at the top of your App settings.
- API Key and Secret: Click Regenerate or View under the "Consumer Keys" section.
- Copy and Save: Your API Key (Client ID) and API Secret Key (Client Secret).
⚙️ Platform Integration¶
Navigate to Admin Panel → Settings → Login Settings → Social Login.
- Twitter Client ID: Paste your API Key.
- Twitter Client Secret: Paste your API Secret Key.
- Twitter Enabled: Toggle to
ON. - Save Settings: Apply the changes at the bottom of the page.
🔍 Technical Details¶
Endpoint Mapping¶
The platform maps the following X (Twitter) attributes into the Publisher model:
id→ Unique social identity tracking.email→ Used for primary account identification (Requires "Request email from users" permission in X Portal).name→ Mapped to the Publisher's profile name.
Authentication Scopes¶
The platform utilizes the OAuth 2.0 PKCE flow where supported by the underlying Socialite driver, ensuring modern security standards for identity exchange.
Troubleshooting¶
- Email Sharing: By default, X does not share user emails. Ensure you have enabled the "Request email from users" checkbox in the User Authentication Settings of your X App.
- Callback mismatch: Double-check that your callback URL uses
https://as X (Twitter) requires SSL for all authentication redirects.