Errors

What each OAuth 2.0 / OpenID Connect error means when integrating with NIA — where it shows up, why it happens, and how to fix it.

How errors are returned

NIA reports errors in two places, depending on the step:

Authorization endpoint — errors come back as query parameters on your redirect_uri, so your callback route should handle them:

redirect
https://app.example.com/auth/callback?error=access_denied&error_description=...&state=...

Token, UserInfo, introspection & revocation — errors come back as a JSON body with an error field and HTTP 4xx:

response
{
  "error": "invalid_grant",
  "error_description": "Authorization code is invalid, expired, or already used."
}

Authorization endpoint errors

errorMeaningFix
invalid_requestA required parameter is missing or malformedCheck response_type=code, client_id, redirect_uri, scope, and PKCE params
unauthorized_clientThe client may not use this grant/response typeEnable authorization_code for the client in the dashboard
access_deniedThe user declined consent, or a policy blocked itExpected when the user clicks Deny — handle it gracefully
unsupported_response_typeresponse_type is not codeNIA only supports response_type=code
invalid_scopeA requested scope is not allowed for this clientAdd the scope to the client's allowed scopes
server_errorUnexpected error on NIA's sideRetry; if it persists, contact support

Token endpoint errors

errorMeaningFix
invalid_clientClient authentication failedCheck client_id / client_secret and the auth method (public clients send no secret)
invalid_grantThe code or refresh token is invalid, expired, used, or the redirect_uri / PKCE verifier doesn't matchCodes are single-use and short-lived; ensure redirect_uri matches and the code_verifier is correct
unsupported_grant_typegrant_type is not supportedUse authorization_code, refresh_token, or client_credentials
invalid_requestMissing or malformed parameterEnsure Content-Type is application/x-www-form-urlencoded and all fields are present
invalid_scopeRequested scope exceeds what was grantedRequest a subset of the originally granted scopes

Common problems & fixes

SymptomCauseFix
redirect_uri_mismatchThe redirect URI doesn't exactly match a registered oneRegister the exact URI — no trailing slash, correct scheme/host/port/path
invalid_grant on PKCEcode_verifier missing or the session was lost between /authorize and /tokenPersist the verifier in the session; ensure cookies survive the redirect (SameSite=Lax)
state / nonce mismatchThe session cookie didn't survive the round-tripCheck cookie domain, Secure, and SameSite settings
CORS blocked (SPA)A browser client calls /token from an origin not on the allowlistAdd the app's origin to the client's CORS allowlist (browser/public clients only)
Signature verification failedServer clock skew, or an unknown kidSync server time (NTP); refetch the JWKS by kid
Wrong issuerUsing dev-platform instead of the API hostThe issuer is https://dev-api.niaauth.com