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

Microsoft Entra ID: AADSTS7000215: Invalid client secret provided

The client secret sent to the token endpoint is not one Entra has for that app registration. By far the most common reason is copying the secret's ID instead of its Value, since the portal shows both side by side and only reveals the value once. Expired secrets, a secret from a different app registration and unencoded special characters in a form body are the other causes.

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
# The value looks like abc8Q~xxxxxxxx..., the ID looks like a GUID.
# A GUID in your config means you copied the Secret ID.

# List the app's secrets and their expiry dates
az ad app credential list --id <application-client-id> \
  --query '[].{hint:hint, end:endDateTime}' -o table

# Create a new secret and copy the value it prints
az ad app credential reset --id <application-client-id> --append --years 1

# Test the token request directly (URL-encode the secret)
curl -s https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/token \
  --data-urlencode client_id=<application-client-id> \
  --data-urlencode client_secret='<value>' \
  --data-urlencode scope=https://graph.microsoft.com/.default \
  --data-urlencode grant_type=client_credentials

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.