Go to developer

Errors & Troubleshooting

Use API codes when you have them; use symptoms when the failure is in the browser UX.

On this page

API error codes

OAuth Verify endpoints return structured errors. Common codes from start, token, and validate:

ErrorHTTPWhereMeaningFix
invalid_redirect_uri400Startredirect_uri not exact match of project_callback_url or project_hosted_redirect_uris[]Register the exact URI; check trailing slash / scheme
invalid_client401Validate (and related)Client id rejected for the token / requestUse the publishable id that started the flow
invalid_verification_token401/verify/validateUnknown, expired, or malformed tokenSend the fresh access_token from exchange
verification_token_already_used409/verify/validateToken already consumed in keyra_verification_token_consumptionsStart a new login; do not retry validate with the same token

Web SDK errors

Class / codeWhenRetry?
KeyraOAuthError · popup_blockedBrowser blocked the popupYes — fall back to redirect
KeyraOAuthError · popup_closedUser closed the popupYes — user-initiated retry
KeyraOAuthError · verification_deniedUser denied / failed hosted verificationYes — new verify
KeyraOAuthError · callback_state_missingRedirect callback missing stateRestart flow; do not invent state
KeyraOAuthError · invalid_statestate mismatch vs stored transientRestart flow; check sessionStorage not cleared
KeyraTimeoutErrorExceeded timeoutMs (default 120000)Optional — new verify

Paste script errors

  • Failures invoke onError. Popup path may also deliver KEYRA_AUTH_ERROR via postMessage (origin-checked against authOrigin).
  • Redirect PKCE missing from keyra:oauth:flow:v2 → callback cannot complete exchange.
  • Required options missing (authOrigin, clientId, redirectUri) fail before start.

Troubleshooting by symptom

Start fails with invalid_redirect_uri

  • Possible cause: URI not registered; trailing slash; http vs https; wrong project.
  • Fix: Exact match against primary callback or hosted redirect URIs list.
  • Possible cause: Popup blocker; click handler not a direct user gesture.
  • Fix: Open from click; catch popup_blocked; switch to mode: "redirect".

Redirect returns but login does not finish

  • Possible cause: Missing handleRedirectCallback / completeRedirectCallback; cleared sessionStorage; invalid_state.
  • Fix: Run callback completion on the exact redirectUri page; preserve storage keys keyra_sdk_transient / keyra:oauth:flow:v2.

User verified but app session never appears

  • Possible cause: Backend skipped /verify/validate; token never POSTed; validate failed silently.
  • Fix: Require validate → valid: true → create your session. See Server validation.

Second login attempt with same token fails 409

  • Possible cause: Expected — single-use consumption.
  • Fix: Start a new OAuth Verify flow for each login; use your session afterward.

Token exchange fails after successful hosted UI

  • Possible cause: Verifier lost; wrong redirect_uri on exchange; code already used.
  • Fix: Keep PKCE material across redirect; exchange once with matching URI — PKCE.