Introduction
Adding Sign in with Twitter (X) lets your users register and log in with their X account. You’ll create an app in the X Developer Portal using OAuth 2.0, then paste its credentials into your admin Auth Settings page. Credentials are stored securely in the database and applied automatically — there are no.env edits or code changes.
Before you start
- Admin access to your MagicAds platform.
- An X account with access to the X Developer Portal.
- Your site’s public URL (HTTPS strongly recommended).
Step 1 — Note your Callback URL
The callback URL is where X sends users back after they approve sign-in:https://app.example.com/auth/twitter/callback
If your site uses a language prefix in its URLs (localization), the callback may include a locale segment such as
/en/auth/twitter/callback. Whatever you enter in the Callback URL field in Auth Settings must match the value registered in your X app exactly.Step 2 — Create an X (Twitter) app
1
Open the X Developer Portal
Go to developer.x.com, sign in, and open Developer Portal → Projects & Apps. Create a Project and an App inside it if you don’t have one.
2
Enable User authentication settings
Open your app and click Set up under User authentication settings.
- App permissions: Read (sufficient for login). Enable Request email address from users if your access tier offers it.
- Type of App: Web App / Automated App or Bot (a confidential client).
3
Set the Callback URI and website URL
- Callback URI / Redirect URL: add your callback from Step 1:
https://YOUR_DOMAIN/auth/twitter/callback. - Website URL:
https://YOUR_DOMAIN.
4
Copy the OAuth 2.0 credentials
After saving, X shows your OAuth 2.0 Client ID and Client Secret. Copy both.
Step 3 — Configure MagicAds
1
Open Auth Settings
In your platform, go to Admin → Backend Settings → Auth Settings.
2
Enable the master switch
Turn on Social Media Login. This is the master switch for all social providers, and it saves immediately.
3
Enable Twitter and enter credentials
Turn on the Twitter toggle, then fill in:
- API Key → paste your X OAuth 2.0 Client ID.
- API Secret → paste your X OAuth 2.0 Client Secret.
- Callback URL → enter
https://YOUR_DOMAIN/auth/twitter/callback(must match the Callback URI in the X app exactly).
4
Save
Click Save. Twitter only appears as a login option once it’s enabled and both the API Key and API Secret are filled in.
Field mapping reference
Step 4 — Test it
- Open your site’s login page in a private/incognito window.
- Click Sign in with Twitter.
- Authorize the app.
- You should be redirected back and logged into your dashboard.
That’s it — your users can now register and log in with Twitter (X).
Troubleshooting
The platform forces the modern OAuth 2.0 flow for Twitter automatically — you don’t need to configure that. Credentials are stored securely and applied at runtime; no
.env edits are needed.
