Troubleshooting

Symptoms, causes and fixes for onefold integrations — authorization errors, redirect URI mismatches, PKCE, token exchange, refresh, userinfo, the management API and webhooks.

Find the symptom, read the cause, apply the fix.

Before the user reaches your callback

A onefold error page appears instead of the sign-in page

onefold shows its own error page when it cannot safely redirect to your application, or when only you can fix the problem.

CauseFix
code_challenge_method is missing or plainSend code_challenge_method=S256. A missing method means plain. See PKCE.
redirect_uri is not registeredSee the next entry
The client_id is unknownUse the client ID of an application that exists and is not deleted
The application has no redirect URIAdd one on its OAuth2 tab
resource names an unregistered protected resourceRegister it, and send exactly one value. See Protect your API.

The redirect URI is refused

Cause. The redirect_uri in the request does not exactly match a registered one. Each of these makes a different URI:

  • http instead of https
  • a trailing slash: /callback and /callback/
  • a different port: localhost:3000 and localhost:3001
  • a different path or query string

Fix. Copy the exact URI your application sends into the application's OAuth2 tab. Register one per environment.

A redirect URI cannot be saved

You enteredWhy it is refusedEnter instead
com.example.app:/callbackSingle-slash formcom.example.app://callback
https://app.example.com/cb#doneIt contains a fragmenthttps://app.example.com/cb
javascript:…, data:…, file:…A scheme a browser runs or reads itselfAn https, http or application-scheme URI

How many redirect URIs you can register depends on your plan.

A mobile application never receives the redirect

  • Open the authorization URL in the system browser, not an embedded web view.
  • Check that the application has claimed the scheme or link you registered.
  • Make the application a public client. See Mobile and desktop.

The sign-in page is blank inside a frame

The sign-in, sign-up and consent pages cannot be shown inside an <iframe> or any other frame, on your site or another. Redirect the browser to the authorization URL instead. See Hosted sign-in page.

At your callback

The callback carries error instead of code

errorCauseFix
access_deniedThe user chose DenyNothing to fix. Let them try again.
invalid_scopeA requested scope is not enabled for the applicationEnable it on the OAuth2 tab, or stop requesting it. openid is always allowed. A socials:<provider> scope also needs that provider configured.
invalid_requestA required parameter is missing, most often code_challengeSend every required parameter. See the request.
login_requiredYou sent prompt=none and the user has no session on onefold, their sign-in is older than the max_age you sent, or their session does not meet the organization's security policy (too old, or made on another application's page)Start a normal sign-in, without prompt=none
interaction_requiredYou sent prompt=none and the organization's security policy requires a second factor the user has not provided in this sessionStart a normal sign-in, without prompt=none; the hosted page asks for the second factor
consent_requiredYou sent prompt=none and the user would be shown the consent screenStart a normal sign-in, without prompt=none

The callback handler rejects the response

Cause. The handler refuses a query parameter it does not expect. Every response carries iss.

Fix. Accept iss. See The iss parameter.

state does not match

Cause. The stored value was lost, or the callback belongs to a sign-in your application did not start.

Fix. Store state where it survives the redirect: a cookie or server session, or sessionStorage in a browser application. Refuse a callback whose state does not match.

At the token endpoint

The token request fails

ResponseCauseFix
400 invalid_grantThe code was already used or is older than 60 seconds, the redirect_uri differs from the authorization request, the code_verifier does not match the challenge, or a code_verifier was sent for a code requested without a challengeExchange each code once, promptly, with the same redirect_uri and the verifier from the same sign-in
400 invalid_request mentioning PKCENo code_verifier was sent. PKCE is required by default, of a confidential client too. See PKCE.Send code_challenge with S256 on the authorization request and the matching code_verifier here
401 invalid_clientA wrong client ID or secret, or a public client that sent a client_secretCheck the credentials. A public client sends no secret.
400 on a request that looks rightThe body was sent as JSONSend application/x-www-form-urlencoded
400 invalid_targetresource is unregistered, was sent twice, or differs from the authorization requestOmit resource here, or repeat the original value
429 with rate_limitedYour application used its request budget for the minuteWait retry_after seconds, then retry
429 with token_exchange_locked_outToo many requests with a wrong client secretFix the secret. Retrying the same one cannot succeed.

A browser token request fails with no error body

Cause. The application's origin is not in Allowed Origins. The exchange succeeds on the server and the browser discards the response.

Fix. Add the origin, with scheme, host and port, on the OAuth2 tab. http is accepted only for loopback addresses. See Token exchange.

After sign-in

Everything stops working after a token refresh

Cause. A refresh token was used twice. Every refresh returns a new refresh token and spends the old one. A spent token presented more than 10 seconds later ends every token from that sign-in.

Fix. Save the new refresh token from every response, never retry with an old one after the retry window, and let only one process or tab refresh at a time. See Keep users signed in.

A user is signed out unexpectedly

Cause. Their grant ended, or a token expired. Userinfo answers 401, or a refresh answers invalid_grant.

Fix. Send the user through sign-in again. Retrying does not help. When access ends lists every cause.

Signing out of your application leaves the user signed in to onefold

Cause. This is how onefold works. There is no end-session endpoint.

Fix. End your own session and revoke the refresh token. See Sign out and revoke.

Userinfo refuses the token, or returns little

SymptomCauseFix
/o/userinfo/ refuses the tokenThat endpoint needs the openid scopeRequest openid, or call /api/v1/userinfo/
Both userinfo endpoints refuse the tokenThe token is audience-bound, issued for a resourceUse an ordinary token for userinfo
A claim is missingIt needs a scope the user did not grant, or the user has no value for itSee Scopes and claims
The access token will not decodeIt is opaqueRead claims from the ID token or from userinfo

A user's ID is wrong, or two users collide

Cause. An ID was converted to a number. IDs are 64-bit, larger than a JavaScript number holds exactly.

Fix. Keep IDs as strings in database columns, URLs and comparisons. See Account.

Management API

404 for a user who exists

Cause. An API key reaches only users who hold a grant with your application now. Anyone else answers 404, the same as a user who does not exist.

403 with api_key_scope_missing

Cause. The key lacks the scope the endpoint needs.

Fix. Add the scope to the key on your application's API Keys tab, or use a key that carries it. See Management API.

401 with an API key

Cause. The key was revoked, or was rotated and its grace period ended.

Fix. Use the current key.

Webhooks

Signatures never verify

Cause. Almost always, the body was parsed and serialized again before verifying.

Fix. Sign the raw request body, and use the whole signing secret including eitozx_whsec_. See Verify webhooks.

The handler works with Test and fails on real events

Cause. A test delivery has a sample body with an event key. Real deliveries carry only the event's own fields.

Fix. Read the event name from the X-Webhook-Event header.

The same event arrives twice

Cause. Delivery is at least once.

Fix. Deduplicate on the X-Webhook-Event-Id header.

On this page