Errors and recovery
Return enough information to recover without leaking identities or replaying uncertain work.
Handle the response deliberately
400 invalid_request or invalid_target: review request binding, redirect, PKCE and resource.
401 invalid_client or invalid_token: verify the registered client method, issuer, audience, expiry and session state. A failed OTP can be invalid or expired.
403: the identity is known but its role, tenant, resource or permission does not allow the action.
409: refresh authoritative state and resolve the conflict; retain the user's input.
429: respect Retry-After or the returned OTP cooldown before another attempt.
503 temporarily_unavailable: preserve state and reconcile uncertain mutations before retrying.
Use stable SDK errors
TypeScript and Python expose OAuthError and JwtError. JWT codes include expired, invalid, kid_mismatch, missing_key, audience_mismatch and issuer_mismatch. Rust returns AuthError variants with corresponding OAuth/JWT details.
Do not log OTP values, bearer tokens, API keys or client secrets. Show a safe recovery message and retain an opaque request identifier for investigation. Account recovery and passkey enrollment stay on the issuer-hosted security surface.