SECURITY WARNING: Never run commands you don't understand. Always review code before execution. Use at your own risk.
Auth New Added 26 October 2026

Microsoft Entra ID: AADSTS9002326: Cross-origin token redemption is permitted

The browser swapped the authorisation code for tokens itself, with a fetch that carries an Origin header, but the redirect URI is registered under the Web platform, which Entra treats as a server-side confidential client. MSAL.js 2 and later always does this from the browser using PKCE, so the URI must be listed under Single-page application instead. Apps moved off MSAL.js 1 and the implicit flow hit this because their URIs were registered under Web years ago.

Quick fix

Read the commands before running them. Anything that restarts a service, deletes data or changes permissions should be tried on a non-production system first.

Quick fix
# Where is each redirect URI registered?
az ad app show --id <client-id> --query "{web:web.redirectUris, spa:spa.redirectUris}"

# Move the browser URIs to the SPA platform. In the portal:
# App registrations > Authentication > Add a platform > Single-page application
# Or with Microsoft Graph:
az rest --method PATCH \
  --uri "https://graph.microsoft.com/v1.0/applications(appId='<client-id>')" \
  --body '{"spa":{"redirectUris":["http://localhost:3000","https://app.example.com"]}}'

# Then remove the same URIs from the Web platform, unless a server-side
# part of the app still redeems codes with a client secret

# If your server is meant to redeem the code, keep the URI under Web and
# make sure it does not forward the browser's Origin header to /token

How to diagnose Auth errors

Identity errors are almost always configuration mismatches between two systems rather than code bugs: a redirect URI registered with a trailing slash, a client secret that was rotated on one side only, a clock that has drifted past the token skew allowance. Because the identity provider deliberately returns vague errors to avoid leaking information to attackers, the provider's own log is usually far more informative than the message your application receives.

If the quick fix above does not resolve it, work through these steps. They apply to this whole class of error, not just to this one message, which is usually what saves the time.

  1. Open the identity provider's log or event stream first. Auth0, Okta and Keycloak all record a detailed reason that they never send back to the client.
  2. Compare the redirect URI byte for byte, including scheme, port and trailing slash. http://localhost:3000/callback and http://localhost:3000/callback/ are different URIs.
  3. Decode the token rather than guessing. Paste it into a local JWT decoder and check iss, aud, exp and nbf, never a remote paste site, because tokens are credentials.
  4. Check clock skew with timedatectl or ntpq -p. Kerberos, SAML and JWT all reject tokens outside a tight time window, and a drifting VM clock produces intermittent, unreproducible auth failures.
  5. For passkeys and WebAuthn, verify the Relying Party ID matches the origin exactly and that the page is served over HTTPS or on localhost. Nothing else is a secure context.

Tools worth reaching for

  • Provider audit logs
  • jwt decoding (locally)
  • openssl x509 -noout -text
  • browser devtools network tab

Authoritative references

Primary documentation for this error, worth reading before applying any fix in production.

learn.microsoft.com learn.microsoft.com

Related Auth errors

See all 20 Auth errors →

Browse other categories

Something missing or wrong?

This entry is maintained by hand. If the fix is out of date, incomplete, or you have a better one, email a correction and it will be reviewed.