Claxx Auth
Docs
Sign in
User FAQ
  • Reset my password
  • I can't sign in
  • Didn't get reset email
  • Account linking
  • Session expiry
  • Two-factor auth
Admin Guides
Theme Studio
  • Overview
  • Layouts
  • Styling tokens
  • Concept copy
  • Assets & backgrounds
  • Advanced CSS
Admin Shell
  • Users
  • Providers
  • Clients
  • Invitations
Integrations
  • OIDC flow
  • Provider token brokering
  • Email triggers
  • Webhook events
  • Session contract
Reference
  • API
  • Error codes
  • Event shapes
  • Design tokens

OIDC Integration

Claxx Auth is a standards-compliant OpenID Connect provider. Downstream Claxx apps sign users in by redirecting them to Claxx Auth, exchanging a one-time authorization code for signed tokens, and validating the ID token. This page walks through the full flow and documents the exact parameters, claims, and error conditions a production client must handle.

Every Claxx app integrates via this path.

Discovery

Claxx Auth publishes a spec-compliant discovery document:

# The issuer is your tenant's hostname. Use the one in your integration guide.
GET https://auth.example.com/.well-known/openid-configuration
{
    "issuer": "https://auth.example.com",
    "authorization_endpoint": "https://auth.example.com/api/oidc/authorize",
    "token_endpoint": "https://auth.example.com/api/oidc/token",
    "userinfo_endpoint": "https://auth.example.com/api/oidc/userinfo",
    "jwks_uri": "https://auth.example.com/api/oidc/jwks",
    "introspection_endpoint": "https://auth.example.com/api/oidc/token/introspect",
    "revocation_endpoint": "https://auth.example.com/api/oidc/token/revoke",
    "end_session_endpoint": "https://auth.example.com/api/oidc/end-session",
    "scopes_supported": ["openid", "profile", "email"],
    "response_types_supported": ["code"],
    "grant_types_supported": ["authorization_code", "client_credentials"],
    "subject_types_supported": ["pairwise"],
    "id_token_signing_alg_values_supported": ["ES256"],
    "token_endpoint_auth_methods_supported": ["private_key_jwt"],
    "code_challenge_methods_supported": ["S256"],
    "authorization_response_iss_parameter_supported": true
}

Your OIDC client library should consume the discovery document and reuse its URLs. Do not hardcode endpoints — they are versioned with the service.

Source: server/routes/.well-known/openid-configuration.get.ts.

Register a client

Before integrating, ask a Claxx Auth admin to create an OAuth client for your app (see /admin/clients). You will receive:

  • Client ID: a UUID. Used as client_id and as the aud claim in ID tokens.
  • Client authentication: private_key_jwt for every application, with a key ID and an ES256 private key that the admin gives you once and that stays on your server. There is no client secret, and there is no browser-only (single-page) client: the sign-in runs on your server. See Client authentication.
  • Allowed scopes: typically openid profile email. admin is never available to an application that signs people in: see Application types and the admin scope.
  • Redirect URIs: Claxx Auth rejects any redirect_uri that is not exactly one of the registered values. See Redirect addresses.
  • Post-logout redirect URIs: registered separately from redirect URIs, under the same rules. Every application that signs people in has at least one.

Redirect addresses

Redirect URIs and post-logout redirect URIs follow one rule, when an admin registers them and when your application sends them:

  • an absolute https:// address; plain http:// only on localhost, 127.0.0.1 and [::1], for development;
  • no user name or password, no fragment (#...), no query (?...), and no *. Nothing is a pattern: each address is registered in full;
  • the address you send is accepted only when, once normalized the way a URL parser does it, it equals a registered one. The scheme, host, port and path must be the same. A host in capitals is the same host and :443 on https is the same as no port; a trailing slash, another port, another path or an added query is not.

For the Nuxt module the two addresses are https://<your app>/auth/callback and https://<your app>/.

Application types and the admin scope

TypeSigns people inGrants it may useadmin scope
confidentialYesauthorization_codeNever
serviceNoclient_credentials onlyAllowed

New applications are confidential or service. An older record of type public still signs people in with authorization_code and its private key, but cannot use client_credentials, sign-in links or the session revoke endpoint; ask an admin for a confidential application instead.

  • A service application is a server's key. It has no redirect URIs. The authorization endpoint answers it with unauthorized_client (as a JSON body on this host, since there is no redirect URI to send it to), and so do the token endpoint for authorization_code, /api/oidc/sign-in-link, /api/oidc/session/check and /api/oidc/session/revoke. It may call /api/oidc/token with client_credentials, and /api/oidc/token/introspect and /api/oidc/token/revoke for its own tokens.
  • admin lets a client_credentials token call the admin API: as an admin of the application's tenant, or as a platform admin when the application belongs to the platform's own tenant (on the platform's own address only). Only a service application may hold it, and only a platform admin signed in to the admin pages can give it. Every admin request made with such a token is recorded (admin.service_token.used).
  • A request for admin at /api/oidc/authorize is refused with invalid_scope. A token issued to a person never carries admin, and only a service application can ask for a client_credentials token (any other is answered unauthorized_client).

The authorization code flow with PKCE

PKCE is required for every client, on top of the client's key. Claxx Auth rejects any code_challenge_method other than S256, and rejects authorization requests without a nonce.

1. Generate PKCE values and anti-forgery state

import { randomBytes, createHash } from 'node:crypto';

const codeVerifier = randomBytes(64).toString('base64url'); // 43–128 chars
const codeChallenge = createHash('sha256').update(codeVerifier).digest('base64url');
const state = randomBytes(32).toString('base64url');
const nonce = randomBytes(32).toString('base64url');

Persist codeVerifier, state, and nonce in a server-side session keyed to the browser (or a signed, HttpOnly cookie). The values must survive the round-trip to Claxx Auth.

2. Redirect the user to the authorization endpoint

GET https://auth.example.com/api/oidc/authorize
  ?client_id=7f9b0e7e-...-a11c
  &redirect_uri=https%3A%2F%2Fapp.example.com%2Fauth%2Fcallback
  &response_type=code
  &scope=openid%20profile%20email
  &state=<opaque>
  &nonce=<opaque>
  &code_challenge=<pkce-challenge>
  &code_challenge_method=S256

Required parameters:

ParameterValue
client_idRegistered client UUID.
redirect_uriExactly one of the client's registered URIs, after normalizing (rules).
response_typecode. Any other value returns unsupported_response_type.
scopeSpace-separated. Must include openid, and every scope must be in the client's allowedScopes.
stateRandom opaque value; echoed back on callback.
nonceRandom opaque value; mirrored into the ID token's nonce claim.
code_challengeBase64url-encoded SHA-256 of the code verifier.
code_challenge_methodS256.

Optional parameters:

ParameterValue
promptlogin makes the person sign in again even if they have a session. none answers without showing a page, or fails with login_required. consent and select_account have no effect.
max_ageSeconds. A session authenticated longer ago than this is treated like prompt=login. 0 always asks for a sign-in.
login_hintAn email address to fill in on the sign-in page.

The person's browser carries the authorization request, so they can remove prompt or max_age from it. When your application depends on a recent sign-in, check the auth_time claim of the ID token: it is signed. The Nuxt module does this for you.

A request without openid in scope is refused with invalid_scope: this is an OpenID Connect provider, and without openid there is no ID token to say who signed in.

Every answer sent to your redirect_uri carries iss, the issuer from discovery (RFC 9207), and discovery says so with authorization_response_iss_parameter_supported: true:

  • success: ?code=<code>&state=<echoed>&iss=<issuer>;
  • error: ?error=<code>&error_description=<text>&state=<echoed>&iss=<issuer>.

On the callback, check state, then refuse the response unless iss is present and is exactly the issuer you configured. That is what stops an answer from another provider (or another tenant's address) being taken for this one's. error_description is one fixed sentence per error code; do not parse it.

Once client_id and redirect_uri are found valid, every other fault is sent to your redirect_uri that way. A request with an unknown client or an unregistered redirect URI is answered on the Claxx Auth host instead, because there is then nowhere safe to send the browser.

Source: server/api/oidc/authorize.get.ts.

3. Claxx Auth handles the user

  • If the user has an active Claxx Auth session, Claxx Auth issues an authorization code and redirects back immediately (silent re-auth).
  • Otherwise, Claxx Auth renders the hosted login page, completes sign-in (local password or federated), and then issues the code.
  • If the user requires a forced password reset, Claxx Auth sends them through /reset-password first, returning to the authorize flow on completion.
  • If the user denies consent or cancels, Claxx Auth redirects to redirect_uri with ?error=access_denied&state=<echoed>.

4. Exchange the code at the token endpoint

POST https://auth.example.com/api/oidc/token
Content-Type: application/x-www-form-urlencoded

grant_type=authorization_code
&code=<code>
&redirect_uri=https%3A%2F%2Fapp.example.com%2Fauth%2Fcallback
&client_id=7f9b0e7e-...-a11c
&code_verifier=<pkce-verifier>
&client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Ajwt-bearer
&client_assertion=<signed-jwt>

Every application authenticates with private_key_jwt, the only method in token_endpoint_auth_methods_supported. There is no PKCE-only exchange and no client secret, so the exchange is made from your server.

The authorization code lives 60 seconds and works once. Redeem it straight after the redirect.

Client authentication

The client_assertion (RFC 7523) is a JWT signed with the application's registered key. The same assertion rules apply at every endpoint that takes one (token, introspection, revocation, sign-in link, session check and revoke).

PartRequirement
Header algES256. Anything else, HS256 and none included, is refused.
Header kidThe application's Client Assertion Key ID.
iss and subThe client ID.
audThe token endpoint URL from discovery, or the URL of the endpoint being called. Another endpoint's URL, or another issuer's, is refused.
jtiRequired. A new random value for every assertion.
iatRequired. Not in the future, and not more than five minutes ago.
expRequired. In the future, and not more than five minutes ahead.

The iat and exp limits allow 60 seconds of clock difference; an exp that has passed is refused with none. Each assertion is accepted once: its jti is recorded for the application in the database, so presenting it again, on any instance of the service, is refused with invalid_client until it expires. Sign a new assertion for every request.

Successful response (tokens trimmed for readability):

{
    "access_token": "eyJhbGciOiJFUzI1NiIsImtpZCI6ImJsdWF1dGgtMTcx...",
    "id_token": "eyJhbGciOiJFUzI1NiIsImtpZCI6ImJsdWF1dGgtMTcx...",
    "token_type": "Bearer",
    "expires_in": 3600
}

Both tokens are ES256-signed JWTs (EC P-256, alg: "ES256"). Their typ header tells them apart: at+jwt for the access token (RFC 9068), JWT for the ID token. They last as long as the person's sign-in at Claxx Auth has left, one hour at most: read expires_in, do not assume 3600. A code whose sign-in has ended is refused with invalid_grant. Response headers include Cache-Control: no-store and Pragma: no-cache per RFC 6749 §5.1.

Source: server/api/oidc/token.post.ts, server/utils/oidc/tokens.ts.

5. Validate the ID token

Validate, in order:

  1. Signature. Fetch the JWKS from /api/oidc/jwks, select the key matching the JWT's kid, and verify with ES256.
  2. typ is JWT. An access token (at+jwt) is signed by the same key for the same audience: never accept one as an ID token.
  3. iss equals the issuer returned by discovery (e.g. https://auth.example.com).
  4. aud equals your client ID.
  5. exp is in the future; iat is not in the future (allow 2 minutes of skew).
  6. nonce equals the value you sent in step 2.
  7. at_hash matches the left-most 128 bits of SHA-256 of the access token, base64url-encoded.

Any mature OIDC client library performs these checks correctly — use one.

Signing-key rotation

An admin rotates the signing key from the Signing Keys page. The new key signs every token from that moment. The previous key stays in the JWKS, and is still accepted by Claxx Auth itself, until every token it signed has expired: an hour (the longest a token lives), plus five minutes for another instance of the service that still holds the old key, plus a minute of clock difference. Then it leaves the JWKS. So a token signed a moment before a rotation keeps verifying until it expires.

Cache the JWKS, but fetch it again when a token names a kid you do not have. The response says Cache-Control: public, max-age=300: keep a copy for five minutes at most. Consumers that hardcode JWKS responses will break.

6. Call userinfo (optional)

GET https://auth.example.com/api/oidc/userinfo
Authorization: Bearer <access_token>
{
    "sub": "6f2a8e7e-...-pairwise",
    "name": "Jane Doe",
    "given_name": "Jane",
    "family_name": "Doe",
    "picture": "https://cdn.example.com/u/jane.png",
    "email": "jane@example.com",
    "email_verified": true,
    "emails": ["jane@example.com", "jane.doe@example.com"],
    "auth_method": "password",
    "linked_providers": ["google"],
    "current_provider": "credential",
    "mfa_satisfied": true,
    "auth_assurance_level": "aal2",
    "assurance_source": "local_2fa"
}

A token that is not good is answered 401 with WWW-Authenticate: Bearer error="invalid_token" and {"error": "invalid_token", "error_description": "..."}: unknown, expired, an ID token instead of an access token, or one that has stopped working.

Returned claims are scoped — you only get profile claims if the profile scope was granted, and only email claims if email was granted. sub is pairwise — the same user has a different sub for each client, derived deterministically. emails lists all verified aliases so downstream apps can match on any of them.

The current_provider, mfa_satisfied, auth_assurance_level, and assurance_source claims describe the current sign-in event, not the user's long-term account shape. Downstream apps can use them for admission control such as provider-constrained access rules or current-session MFA requirements.

They come from what the session recorded when it was created, never from the account's current settings. A person who signs in with a password and then turns two-factor on keeps an aal1 session until they sign in again with their code. What each way of signing in records:

Sign-incurrent_provideracramrmfa_satisfiedassurance_source
Passwordcredentialaal1['pwd']falsepassword
Password, then authenticator code or backup codecredentialaal2['pwd', 'mfa']truelocal_2fa
Passkey (the device checked a PIN or biometric)passkeyaal2['hwk', 'mfa']truepasskey
Emailed sign-in linkemail_linkaal1['otp']falseemail_link
Upstream identity providerthe provider slugnonenonenullupstream

A passkey sign-in where the device did not verify the person is refused, so there is no passkey session below aal2.

The authorization endpoint also applies your application's own sign-in rules to the session before it issues a code: a session your application would not have let in is sent back to sign in again (see clients → sign-in rules).

Source: server/utils/oidc/userinfo.ts.

ID token claims

ClaimNotes
issIssuer, matches discovery.
subPairwise per (user, client). Stable across sessions.
audYour client ID.
exp, iatExpiry and issue time (Unix seconds). At most 1 hour, and never past the end of the sign-in.
nonceEchoed from authorize request.
at_hashLeft half of SHA-256 of the access token.
auth_timeWhen the person authenticated (Unix seconds).
sidThe sign-in, sealed for your application: opaque, different at every application. Send it to POST /api/oidc/session/check. Not a credential.
session_expires_atWhen that sign-in ends at Claxx Auth (Unix seconds). Keep your own session no longer than this.
acrAssurance level the session proved: aal1 or aal2.
amr['pwd'], ['pwd', 'mfa'], ['hwk', 'mfa'] for a passkey, or ['otp'] after an emailed sign-in link; absent when federated.
auth_methodpassword, <provider-slug>, or service.
linked_providersArray of provider slugs the user has linked.
current_providerProvider that authenticated the current session.
mfa_satisfiedtrue, false, or null for the current session.
auth_assurance_levelAssurance summary such as aal1, aal2, or null.
assurance_sourceHow Claxx Auth derived assurance for the session.
email, email_verified, emailsPresent when email scope granted.
name, given_name, family_name, picturePresent when profile scope granted.

When a token stops working

An access token is good at userinfo, at introspection and at /api/provider-tokens only while what it stands for still stands. It stops working at once, not when it expires an hour later, when:

  • the sign-in it came from ends: the person signs out here or through the end-session endpoint, a password change or a completed reset ends their other sessions, a passkey removal or an admin ends their sessions, the account is marked to choose a new password, or the sign-in's own time runs out (the tenant's sign-in lifetime, twelve hours at most). Signing in again gives new tokens; the old ones stay dead;
  • the person's account is deleted;
  • the application is switched off or deleted;
  • the person is signed out of the application after the sign-in the token came from (POST /api/oidc/session/revoke, or Sign out of this application in the admin pages). A sign-in made after the revocation is not touched.

A client_credentials token stops working when its application is switched off, deleted, or is no longer of type service.

Claxx Auth does not look at an ID token again once it is issued. To find out that the sign-in behind your session has ended, or that the person was signed out of your application, ask POST /api/oidc/session/check (see Signing a person out).

Keeping your own session

Your application's session lives only while the sign-in it came from does. The Nuxt module (@claylevering/auth-nuxt) does all of this. An application built without it must do it itself:

  1. Keep sub, auth_time and sid from the ID token with your session. Refuse an ID token without sid: a session made from it cannot be checked.
  2. End your session no later than session_expires_at, whatever lifetime you chose for it. Count from when you make it; do not extend it past that moment.
  3. Ask POST /api/oidc/session/check for each active session about once a minute (sub, auth_time, sid, with your client authentication). End the session at once when the answer is {"active": false}.
  4. Treat anything other than 200 {"active": true} as no answer. Keep the session for a limited time after its last true (the module allows fifteen minutes), then end it. Never keep a session running on no answers.
  5. A 401 from userinfo or /api/provider-tokens for your session's access token means the sign-in has ended: end the session then too.
  6. Check where the session is read, not only in a middleware that some paths skip. A middleware that leaves build assets or its own routes alone, deciding on a parsed URL, can be walked past with dot segments (/api/x/%2e%2e/%2e%2e/_nuxt/): a parsed URL resolves them, the router does not. Decide on the path as sent, refuse one with a dot segment, and do the due check in the function every route calls to get the session. A check without sid is 400 sid_required.

Signing in again is quiet while the person is still signed in here: send the browser through the authorization endpoint, and a live sign-in comes straight back with a code.

Refreshing tokens

Claxx Auth does not issue OAuth refresh tokens to downstream apps today. When an access token expires, your client should re-enter the authorize flow. If the user's Claxx Auth session is still active, Claxx Auth issues a new code without user interaction (prompt=none answers without showing a page, or fails with login_required).

Plan for this on your server: when your own session or the access token runs out, send the browser through the authorization endpoint again (a full navigation), exchange the new code on your server, and resume.

Logout

RP-initiated logout follows OIDC RP-Initiated Logout 1.0:

GET https://auth.example.com/api/oidc/end-session
  ?id_token_hint=<id_token>
  &post_logout_redirect_uri=https%3A%2F%2Fapp.example.com%2Fsigned-out
  &state=<opaque>

Claxx Auth clears the Better Auth session cookie, deletes the session row from D1, and redirects to post_logout_redirect_uri when it is exactly one of the registered post-logout redirect URIs of an active client of this tenant (rules). Any other address is not followed: the person is signed out all the same and lands on Claxx Auth's own page. See Session Contract for full logout semantics.

Source: server/api/oidc/end-session.get.ts.

Revocation and introspection

Claxx Auth implements RFC 7009 (Token Revocation) and RFC 7662 (Token Introspection). Both require client authentication, with aud set to the endpoint's URL or the token endpoint's. A client that cannot be authenticated gets 401 {"error": "invalid_client"}.

POST https://auth.example.com/api/oidc/token/revoke
Content-Type: application/x-www-form-urlencoded

token=<access_token>&token_type_hint=access_token
POST https://auth.example.com/api/oidc/token/introspect
Content-Type: application/x-www-form-urlencoded

token=<access_token>
{
    "active": true,
    "sub": "6f2a8e7e-...-pairwise",
    "client_id": "7f9b0e7e-...-a11c",
    "scope": "openid profile email",
    "token_type": "Bearer",
    "exp": 1744823025,
    "iat": 1744819425
}

The answer is {"active": false} for a token that is unknown, expired, issued to another client, not an access token (an ID token, say), or one that has stopped working.

Edge cases

  • State mismatch on callback. Reject the response and restart the flow. Never trust an unvalidated state.
  • Expired code. Codes are valid for 60 seconds. Attempting to exchange an expired code returns invalid_grant.
  • Reused code. Codes are single-use. The exchange takes the code out of the store in one step, so of two requests with the same code exactly one gets tokens; the other gets invalid_grant. Only a hash of each code is stored.
  • A failed exchange uses the code up. A wrong code_verifier, redirect_uri or client still consumes the code. Start a new sign-in; do not retry the exchange.
  • PKCE verifier mismatch. Returns invalid_grant. Ensure you're sending the exact verifier you generated — not the challenge.
  • Replayed client assertion. An assertion is accepted once. Reusing one returns invalid_client.
  • Scope escalation. Requesting a scope outside allowedScopes, or admin at all, or leaving out openid, aborts the flow at /authorize with invalid_scope.
  • Changing redirect_uri mid-flow. The value in step 4 must be the same text as in step 2, character for character.
  • A redirect URI that is almost right. A trailing slash, another port, another path or an added query is a different address and is refused at /authorize with Invalid redirect_uri, shown on Claxx Auth's host.

Example client (Node + openid-client)

import { Issuer, generators } from 'openid-client';

const issuer = await Issuer.discover('https://auth.example.com');

const client = new issuer.Client(
    {
        client_id: '7f9b0e7e-...-a11c',
        redirect_uris: ['https://app.example.com/auth/callback'],
        response_types: ['code'],
        token_endpoint_auth_method: 'private_key_jwt',
        id_token_signed_response_alg: 'ES256'
    },
    {
        keys: [
            /* your JWK */
        ]
    }
);

// Redirect
const code_verifier = generators.codeVerifier();
const code_challenge = generators.codeChallenge(code_verifier);
const state = generators.state();
const nonce = generators.nonce();

const authUrl = client.authorizationUrl({
    scope: 'openid profile email',
    code_challenge,
    code_challenge_method: 'S256',
    state,
    nonce
});

// Callback
const params = client.callbackParams(req);
const tokenSet = await client.callback('https://app.example.com/auth/callback', params, { code_verifier, state, nonce });

const claims = tokenSet.claims();

Errors

Claxx Auth returns spec-compliant OAuth 2.0 error responses on the authorize endpoint (query-string redirect, with iss), on the token, introspection and revocation endpoints (JSON body), and on userinfo (401 with WWW-Authenticate: Bearer error="invalid_token"). The error_description is a fixed sentence for each code and says nothing about the particular request; Claxx Auth records the reason in its audit log.

ErrorMeaning
invalid_requestMissing or malformed parameter.
unauthorized_clientClient exists but isn't allowed for this grant or scope.
access_deniedUser cancelled, denied consent, or was blocked by policy.
invalid_grantCode expired, already used, or PKCE verifier mismatched.
invalid_clientClient authentication failed (HTTP 401): a missing, malformed, expired, replayed or wrongly signed assertion, or an unknown or switched-off client.
unsupported_grant_typegrant_type was not one the token endpoint supports.
login_requiredprompt=none, and the person must sign in first.
interaction_requiredprompt=none, and the person must set a new password.
invalid_scopeopenid is missing, a requested scope isn't in allowedScopes, or it is admin.
unsupported_response_typeresponse_type was not code.
invalid_tokenuserinfo only: the access token is not good (HTTP 401).
server_errorInternal — report with request ID.

For full server-side error codes and JSON response shapes see API errors and the API reference.

Picking a library

Any conformant OIDC client library that runs on a server and supports private_key_jwt works. A library that runs only in the browser cannot keep the private key, and Claxx Auth has no client that signs in without one. For a Nuxt application, use the @claylevering/auth-nuxt module.

  • Node / TypeScript (server): openid-client.
  • Go: go-oidc.
  • Python: authlib.
  • Rust: openidconnect.

Always configure via discovery URL. Always verify ID token signatures against the JWKS. Never skip nonce validation.

On this page

  • Discovery
  • Register a client
  • Redirect addresses
  • Application types and the admin scope
  • The authorization code flow with PKCE
  • 1. Generate PKCE values and anti-forgery state
  • 2. Redirect the user to the authorization endpoint
  • 3. Claxx Auth handles the user
  • 4. Exchange the code at the token endpoint
  • 5. Validate the ID token
  • 6. Call userinfo (optional)
  • ID token claims
  • When a token stops working
  • Keeping your own session
  • Refreshing tokens
  • Logout
  • Revocation and introspection
  • Edge cases
  • Example client (Node + openid-client)
  • Errors
  • Picking a library
DocsPrivacyTerms
© 2026 Claxx Digital Group