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.
| Cause | Fix |
|---|---|
code_challenge_method is missing or plain | Send code_challenge_method=S256. A missing method means plain. See PKCE. |
redirect_uri is not registered | See the next entry |
The client_id is unknown | Use the client ID of an application that exists and is not deleted |
| The application has no redirect URI | Add one on its OAuth2 tab |
resource names an unregistered protected resource | Register 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:
httpinstead ofhttps- a trailing slash:
/callbackand/callback/ - a different port:
localhost:3000andlocalhost: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 entered | Why it is refused | Enter instead |
|---|---|---|
com.example.app:/callback | Single-slash form | com.example.app://callback |
https://app.example.com/cb#done | It contains a fragment | https://app.example.com/cb |
javascript:…, data:…, file:… | A scheme a browser runs or reads itself | An 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
error | Cause | Fix |
|---|---|---|
access_denied | The user chose Deny | Nothing to fix. Let them try again. |
invalid_scope | A requested scope is not enabled for the application | Enable it on the OAuth2 tab, or stop requesting it. openid is always allowed. A socials:<provider> scope also needs that provider configured. |
invalid_request | A required parameter is missing, most often code_challenge | Send every required parameter. See the request. |
login_required | You 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_required | You sent prompt=none and the organization's security policy requires a second factor the user has not provided in this session | Start a normal sign-in, without prompt=none; the hosted page asks for the second factor |
consent_required | You sent prompt=none and the user would be shown the consent screen | Start 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
| Response | Cause | Fix |
|---|---|---|
400 invalid_grant | The 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 challenge | Exchange each code once, promptly, with the same redirect_uri and the verifier from the same sign-in |
400 invalid_request mentioning PKCE | No 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_client | A wrong client ID or secret, or a public client that sent a client_secret | Check the credentials. A public client sends no secret. |
400 on a request that looks right | The body was sent as JSON | Send application/x-www-form-urlencoded |
400 invalid_target | resource is unregistered, was sent twice, or differs from the authorization request | Omit resource here, or repeat the original value |
429 with rate_limited | Your application used its request budget for the minute | Wait retry_after seconds, then retry |
429 with token_exchange_locked_out | Too many requests with a wrong client secret | Fix 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
| Symptom | Cause | Fix |
|---|---|---|
/o/userinfo/ refuses the token | That endpoint needs the openid scope | Request openid, or call /api/v1/userinfo/ |
| Both userinfo endpoints refuse the token | The token is audience-bound, issued for a resource | Use an ordinary token for userinfo |
| A claim is missing | It needs a scope the user did not grant, or the user has no value for it | See Scopes and claims |
| The access token will not decode | It is opaque | Read 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.