Skip to main content

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.
Twitter does not share email by default. Email access requires the elevated Request email address from users permission on your X app, which is gated behind X’s developer access tiers. If your app can’t return an email, sign-in fails with “Your social account did not share an email address.” Confirm email access is available on your X plan before relying on Twitter login.

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://YOUR_DOMAIN/auth/twitter/callback
For example: 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.
Save the settings.
4

Copy the OAuth 2.0 credentials

After saving, X shows your OAuth 2.0 Client ID and Client Secret. Copy both.
Be sure to use the OAuth 2.0 credentials — not the legacy API Key/Secret from the “Consumer Keys” section. Using the wrong pair causes a “Something went wrong” error on authorize.

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

MagicAds fieldX (Twitter) value
API KeyOAuth 2.0 Client ID
API SecretOAuth 2.0 Client Secret
Callback URLCallback URI / Redirect URL (/auth/twitter/callback)

Step 4 — Test it

  1. Open your site’s login page in a private/incognito window.
  2. Click Sign in with Twitter.
  3. Authorize the app.
  4. 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

SymptomLikely causeFix
”Your social account did not share an email address”Email access not enabled on the X app/planEnable Request email address from users (requires the right X access tier). Without email, login can’t complete.
Callback / redirect errorCallback URI mismatchMake the Callback URI in the X app exactly equal the Callback URL in Auth Settings.
”Something went wrong” on authorizeUsed OAuth 1.0a Consumer Keys instead of OAuth 2.0Use the OAuth 2.0 Client ID and Client Secret, not the legacy API Key/Secret.
Twitter button doesn’t appearMaster switch off, Twitter toggle off, or credentials blankEnable Social Media Login and Twitter, and fill both API Key and API Secret.
”Registration is currently closed” after authorizeNew-user creation blockedEnable public registration in your platform settings, or pre-create the account.
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.