Security
What onefold enforces for every application, and what your application must do itself to integrate securely — PKCE, state, token storage, ID token validation, revocation and webhook verification.
Security in an integration is shared. onefold enforces a set of rules you cannot turn off; PKCE alone has a narrow exception. The rest is your application's job, and onefold cannot do it for you.
What onefold enforces
These hold for every application, on every plan.
| Rule | Detail |
|---|---|
| PKCE by default | Required of confidential clients too, unless a confidential client whose redirect URIs are all https on another host turns it off. Public clients and custom-scheme or loopback redirect URIs always require it. Only S256 is accepted, and a challenge that is sent is always verified. See PKCE. |
| Authorization code flow only | No implicit flow, no hybrid flow, no password grant |
| Exact redirect URI matching | No wildcards and no partial matches |
| Short-lived, single-use codes | An authorization code works once and expires after 60 seconds. A code presented again shortly after its exchange revokes the tokens that exchange issued. |
| Consent is decided by onefold | No request parameter can skip the consent screen |
| Signed ID tokens | RS256, with keys published as a JSON Web Key Set |
| Opaque access tokens | An ordinary access token carries no readable claims |
| Audience binding | A token issued for a protected resource is refused everywhere else |
| Refresh token rotation | Every refresh spends the old token. Reuse outside the retry window revokes every token from that sign-in. |
| Immediate revocation | A token you revoke is refused at once, with no retry window |
| Secrets shown once | Client secrets and API keys are stored hashed and never displayed again |
| Client secret lockout | Repeated wrong client secrets at the token endpoint are temporarily refused |
| Signed webhooks | Every delivery carries an HMAC-SHA256 signature and a timestamp |
| Webhook targets | https only, public addresses only, redirects not followed |
| Read-only scopes | No scope lets an application change a user's account |
| Consent-scoped data | Your application reads only people who authorized it, and only what they granted |
What your application must do
In the sign-in flow
- Generate a new PKCE verifier and
statefor every sign-in, from a cryptographic random source. - Check
stateon every callback and refuse a mismatch. - Accept
isson the callback. If you sign users in through more than one provider, compare it with the issuer you sent the request to. - Verify the ID token before trusting it: signature with
RS256only,iss,aud,exp, andnoncewhen you sent one. See Verify the ID token. - Do not decode the access token. Use the ID token or userinfo.
With credentials
- Keep the client secret on a server. An application that cannot keep one is a public client.
- Store tokens appropriately: on the server for a web application, in memory for a single-page application, in the platform's secure storage for a native one.
- Never put tokens or secrets in URLs or logs.
- Give API keys the narrowest scopes that do the job. A key with no scopes has all of them.
- Revoke a leaked credential; do not rotate it and wait.
With users
- Key users on
sub, as a string. Do not match users by email address. - Check
email_verifiedbefore you rely on an email address. - Do your own authorization. onefold tells you who the user is. What they may do in your product is your decision.
- Do not trust identity sent by a client. Your API verifies the token itself. See Protect your API.
- Request the fewest scopes you need.
With webhooks
- Verify the signature of every delivery over the raw body, with a constant-time comparison.
- Reject old timestamps. onefold signs the timestamp; checking its age is up to you.
- Make handlers idempotent.
In production
- Use
httpseverywhere: redirect URIs, origins, webhook endpoints. - Use a separate application per environment.
- Revoke the refresh token at sign-out.
- Act on
consent.revoked,profile.disabledandsubject.changed.
What onefold does not do
- It does not tell your application whether a user has multi-factor authentication or a passkey, or which method they signed in with. Your organization's security policy can require a second factor and a maximum sign-in age for its applications. See MFA and passkeys.
- It does not end the user's onefold session when you sign them out. See Sign out and revoke.
- It does not manage your application's own session.
- It does not provide roles or permissions for your end users.
Go-live checklist
What to check before your onefold integration serves real users — applications per environment, redirect URIs, secrets, callback handling, webhooks, custom domains and social providers.
Troubleshooting
Symptoms, causes and fixes for onefold integrations — authorization errors, redirect URI mismatches, PKCE, token exchange, refresh, userinfo, the management API and webhooks.