Unidy Docs

Authentication errors

Look up identity and session error behavior.

Authentication errors

Use the endpoint and response channel to identify the failure, then branch on its machine-readable identifier. OAuth and SDK errors use different envelopes, and some authentication failures have no JSON body.

Where did the error arrive?

Response channelCommon endpointsWhat your application should read
Browser page on UnidyInvalid authorization requests to /oauth/authorizeThe visitor sees the error; your callback may never be called. Check application settings and the original request.
Redirect to your callbackAuthorization denial and OpenID Connect prompt failureserror, optional error_description, and state in the callback. Validate the returned state before handling either success or error.
OAuth JSON response/oauth/token, /oauth/introspect, /oauth/revokeHTTP status and the error identifier.
Bearer challenge, sometimes with an empty body/oauth/userinfo and OAuth-protected REST API v1 routesHTTP status and WWW-Authenticate; do not assume JSON.
SDK JSON response/api/sdk/v1 operationsHTTP status and usually error_identifier. Consult the operation for additional fields and envelope exceptions.

Log the endpoint, status and identifier with a request ID when available. Keep tokens, passwords, authorization codes and full callback URLs out of logs. Descriptions can help diagnosis when sanitized, but their wording and language are not a stable interface. Show your own localized customer messages.

Authorization and silent authentication

A malformed authorization request may render an error on Unidy instead of redirecting to your application, especially when the client or callback cannot be trusted. A signed-out visitor may first encounter the hosted login screen, so reaching that screen does not prove that the authorization parameters are valid.

IdentifierMeaningNext action
invalid_clientThe application could not be identified or authenticated.Check the client ID and environment.
invalid_redirect_uriThe requested callback does not match the application's registered redirect URIs.Compare the scheme, host, port and path. Prefer an explicitly registered callback; do not assume a trailing slash is interchangeable.
invalid_scopeA requested scope is unknown or unavailable to this application.Request only the scopes assigned to the application.
invalid_requestA required parameter is missing or invalid.Check the authorization request against the flow guide.
unsupported_response_typeThe requested response type is unsupported.Use response_type=code for the authorization-code flow.
invalid_code_challenge_methodThe PKCE method is invalid.Use S256 and preserve the corresponding verifier until the exchange.
access_deniedThe visitor declined authorization.Return them to a useful signed-out screen; do not immediately restart consent.
login_requiredA silent request cannot use an existing authenticated session.Offer an interactive sign-in.
consent_required or interaction_requiredThe request needs user interaction.Restart interactively after the user chooses to continue.

The Unidy hosted error page, headed An error has occurred, with a paragraph of apology and a single monospaced line reading The requested redirect uri is malformed or doesn't match client redirect URI.

HOSTED LOGIN — the entire error surface a customer gets from the authorization endpoint. One apology, one sentence, no error code, no request ID and nothing to quote at support. Every row in the table above renders this same page with a different last line.

An OAuth application detail screen in the Unidy dashboard. The Redirect URIs block shows http://localhost:3333/* and the Service block below shows a generated Authorize URL whose redirect_uri parameter is http%3A%2F%2Flocalhost%3A3333, with no trailing slash. The Flags block shows Confidential No and Auto-approve Yes.

OAUTH APPLICATIONS — the same screen shows the registered Redirect URI http://localhost:3333/* and an Authorize URL whose redirect_uri is http%3A%2F%2Flocalhost%3A3333. The two do not match, so the Authorize button on this screen fails · highlight on the generated link

For prompt=none, handle the callback error and a bounded timeout. Browser cookie restrictions can prevent reuse of a hosted session. Malformed requests and server failures can still render a page or fail outside the callback; avoid automatic redirect loops. See Silent authentication.

Token exchange and refresh

OAuth token failures normally contain an error and may include an error_description:

json
{ "error": "invalid_grant" }
StatusIdentifierMeaning and recovery
401invalid_clientCheck client credentials and the application's public/confidential configuration. Retrying unchanged credentials will not help.
400invalid_grantThe code, refresh token, redirect URI or PKCE verifier could not be accepted. Do not reuse an authorization code. For an invalid refresh grant, end the local authenticated state and start authorization again.
400invalid_scopeCorrect the requested scopes and application grants before retrying.
400unsupported_grant_typeUse a supported grant type configured for the application.
400invalid_requestCorrect the missing or malformed request parameters.

Use only machine-to-machine API scopes with client credentials. Identity scopes such as openid, profile and email require a user context and do not belong in that grant.

Distinguish a permanent grant rejection from a network failure, 429 or 5xx. A transport failure does not prove that the server rejected a request: do not launch concurrent refreshes or repeatedly exchange the same code. Preserve the current session while applying the bounded retry strategy in Token refresh, sessions, and logout.

Protected identity endpoints

A failed call to /oauth/userinfo can return an empty body with a bearer challenge:

http
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer error="invalid_token"
Status and identifierRecovery
401 invalid_tokenCheck that the correct access token was sent in the bearer header. Refresh an expired token when possible; otherwise authorize again. Retry the protected read once with the replacement token.
403 insufficient_scopeCheck application grants and the scopes on this token. A refresh cannot invent permission the application or user never granted.

Inspect headers before parsing the body. Treat introspection separately: 200 {"active":false} is a successful introspection response saying the supplied token is not active for that request. It is not a network error or a reason to retry indefinitely.

A logout redirect also does not prove that every application session or token has been revoked. Follow the logout procedure for each session layer.

SDK credentials and sign-in errors

SDK API operations normally authenticate the IntegrationSDK clientThe application configuration and API key used to call Unidy’s customer-facing SDK HTTP API.Not the same as OAuth application: An OAuth application supports OAuth/OIDC flows. An SDK integration does not normally require the integrator to create both configurations.5 fields — listed in full on the pageRelated: OAuth application · REST API · SDK HTTP APIRead the page →Open SDK client (choose an instance) with Authorization: Bearer YOUR_SDK_CLIENT_API_KEY. Operations requiring a signed-in customer additionally use X-ID-Token. Starting a sign-in or registration does not require an already authenticated customer. Browser redirect operations have their own contracts.

Statuserror_identifierRecovery
401missing_api_key / invalid_api_keySupply the SDK client's key for this environment in the bearer header. A customer JWT is not an SDK key.
403origin_not_allowedLink the SDK client to the brand whose host you are calling. This identifier is about the client-brand relationship, not the request's Origin header.
401missing_id_tokenSupply the customer token on an operation that requires one.
401invalid_id_tokenCheck token type, signature, audience and environment. Start a new sign-in if the stored credential is unusable.
401expired_id_tokenRefresh the SDK token pair, then retry once.
403real_email_requiredComplete the real-email step through the profile surface before using the protected operation.
403captcha_token_missing / captcha_verification_failedComplete the SDK client's configured captcha flow and submit a valid captcha token.
404account_not_foundCheck the address and offer the appropriate registration path.
422account_unconfirmedContinue the confirmation or invitation flow indicated by the response.
401account_lockedStop repeated attempts; see the distinction below.
401invalid_passwordLet the person correct their password or start recovery. On password reset, 422 invalid_password instead reports validation errors for the proposed new password.
401magic_code_not_valid / magic_code_expired / magic_code_usedAsk for the current code or request a new one subject to the resend limit.
404sign_in_not_foundStart a fresh sign-in; the supplied sid is not available.
422sign_in_expired / sign_in_already_processedDo not continue authenticating that sign-in. Reconcile local state or begin a new one.
422sign_in_not_authenticatedComplete the required authentication step before submitting fields or continuing.
424missing_required_fieldsRender the fields returned by that operation and complete them before continuing.
401missing_refresh_token / invalid_refresh_token / refresh_token_revoked / refresh_token_expiredSupply the current SDK refresh token for this sign-in. If it is no longer usable, sign in again.
422unprocessable_contentCorrect the payload using the operation's validation details.
429rate_limit_exceededWait for the applicable retry delay; avoid parallel retries.

Temporary and administrative locks

401 account_locked covers both an administrative account lock and a temporary failed-attempt lock. The automatic lock escalates after each group of five failed attempts, from 30 seconds up to six hours. Successful authentication resets the attempt counter.

The authentication error may contain no lock duration. Missing timing metadata does not prove an administrative lock. Stop retrying, show any supplied delay, and offer recovery or support. An authorized administrator can inspect and reset the timed login lock; a deliberate account lock needs an authorized administrative decision. See Account state and access.

Envelopes and successful responses that need attention

SDK operations do not all return the same object. Registration-social failures can use error instead of error_identifier; required-field responses can place fields at different paths. A combined create-sign-in-and-send-code request can return 201 with an embedded error_identifier when sending the code failed. Inspect that field before displaying “Code sent.”

Use Sign-in and registration operations for the complete state transitions and SDK HTTP API reference for the operation-specific contract.

Browser CORS failures

The SDK client's allowed-host configuration controls browser access separately from origin_not_allowed. If CORS fails, fetch or XHR rejects and JavaScript may be unable to read the response. The HTTP request may still have reached the server and performed its action. Inspect the browser console and network panel, fix the allowed origin, and check state before repeating a write.

The SDK client detail screen in the Unidy dashboard for Newsletter SDK, with the Allowed Hosts row highlighted, showing http://localhost:3333 and http://localhost:3334.

SDK CLIENT — Allowed Hosts governs CORS in the browser, not the origin_not_allowed identifier. A CORS failure never reaches your error handler; it is only visible in the browser console · highlight on the Allowed Hosts row

SAML and one-time login

SAML failures are diagnosed at the browser endpoint and service provider; do not assume an OAuth error envelope. Use Test and troubleshoot SAML for its status and configuration checks.

One-time login links are consumed on redemption. An invalid or spent link does not use the SDK error catalogue; generate a new link through the authorized flow described in One-time login.

For authenticated business requests and retry safety, continue to Errors, idempotency, and retries.

Was this page helpful?