Reference

OAuth 2.0 Error Codes Reference

OAuth errors return a JSON body with an error field and usually an error_description. Here is every standard error code, what it means, and how to fix it.

Error CodeMeaningCommon CauseFix
invalid_grantAuthorization code or refresh token is invalidCode expired, reused, PKCE mismatch, refresh token rotatedExchange code immediately; check PKCE verifier; handle rotation
invalid_clientClient authentication failedWrong client_id or client_secret; secret rotatedCheck credentials in provider dashboard; update rotated secret
invalid_requestMalformed requestMissing required parameter; wrong encodingCheck all required params; use URLSearchParams for encoding
unauthorized_clientClient not authorized for this grant typeGrant type not enabled for your appEnable the grant type in provider dashboard
access_deniedUser denied accessUser clicked "Cancel" on consent screenHandle gracefully — redirect to login or show explanation
unsupported_grant_typeServer does not support this grant typeUsing deprecated Implicit Flow or wrong grant typeSwitch to Authorization Code + PKCE for user flows
invalid_scopeRequested scope is invalid or not permittedTypo in scope name; scope not configured for clientCheck exact scope names in provider docs; enable in dashboard
redirect_uri_mismatchredirect_uri does not match registered URITrailing slash, protocol, or port differenceExact string match required — check provider dashboard
server_errorAuth server internal errorProvider-side issueRetry with exponential backoff; check provider status page
temporarily_unavailableAuth server temporarily unavailableProvider maintenance or outageRetry after delay; check provider status page

Error response format

{
  "error": "invalid_grant",
  "error_description": "The provided authorization grant is invalid, expired, or revoked.",
  "error_uri": "https://tools.ietf.org/html/rfc6749#section-5.2"
}

How to debug OAuth errors

  1. Log the full error response — including error_description, not just the status code
  2. Check the exact parameter values you are sending — log them before the request
  3. Use OAuthFixer to walk through the error by provider — Auth0, Okta, Cognito, Google, Microsoft each have specific causes and fixes
Debug your OAuth error → OAuthFixer