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.

RuleDetail
PKCE by defaultRequired 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 onlyNo implicit flow, no hybrid flow, no password grant
Exact redirect URI matchingNo wildcards and no partial matches
Short-lived, single-use codesAn 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 onefoldNo request parameter can skip the consent screen
Signed ID tokensRS256, with keys published as a JSON Web Key Set
Opaque access tokensAn ordinary access token carries no readable claims
Audience bindingA token issued for a protected resource is refused everywhere else
Refresh token rotationEvery refresh spends the old token. Reuse outside the retry window revokes every token from that sign-in.
Immediate revocationA token you revoke is refused at once, with no retry window
Secrets shown onceClient secrets and API keys are stored hashed and never displayed again
Client secret lockoutRepeated wrong client secrets at the token endpoint are temporarily refused
Signed webhooksEvery delivery carries an HMAC-SHA256 signature and a timestamp
Webhook targetshttps only, public addresses only, redirects not followed
Read-only scopesNo scope lets an application change a user's account
Consent-scoped dataYour 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 state for every sign-in, from a cryptographic random source.
  • Check state on every callback and refuse a mismatch.
  • Accept iss on 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 RS256 only, iss, aud, exp, and nonce when 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_verified before 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 https everywhere: redirect URIs, origins, webhook endpoints.
  • Use a separate application per environment.
  • Revoke the refresh token at sign-out.
  • Act on consent.revoked, profile.disabled and subject.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.

On this page