Skip to main content
Prelude Auth lets you control which claims are included in the access tokens issued to your users. With a single configuration per application, you decide what data ends up in the JWT — pulled from the session, the user’s profile, or hardcoded values you define.

Why custom claims?

By default, an access token issued by Prelude only contains the standard JWT claims (iss, sub, exp, …) and the scopes granted to the session. If your backend needs more context — the user’s locale, IP address, your own internal user ID, a loyalty tier — you can declare it once in a claims mapping configuration and Prelude will inject it into every access token issued for that application. You can mix three kinds of values in the same configuration:
  • Hardcoded values — constants that always appear in the token (e.g. an API version number).
  • Built-in inputs — data Prelude already knows about the user or the session (user ID, IP, locales, emails, …).
  • Profile custom claims — arbitrary data you store on the user’s profile via the Management API.

How it works

You configure the mapping once per application through the Management API. From that moment on, every access token Prelude issues for that application — at login, refresh, or step-up — embeds the resolved claims.
When you update the claims mapping, existing sessions automatically pick up the new configuration on their next refresh. There is nothing to do on the client side.

Mapping format

A claims mapping is a free-form JSON object passed under the mapping key. Each top-level key becomes a claim in the access token. Nested objects are preserved as-is.
This produces an access token whose payload includes:

Hardcoded values

Any non-object value (string, number, boolean) is copied verbatim into the token:

Built-in inputs

Use the $input / $type operators to reference data that Prelude already knows about the user and the session. Both operators are required together.
The full list of supported inputs is in Available inputs below.

Profile custom claims

Any field stored on the user’s profile via PATCH /v2/session/apps/{appID}/users/{userID}/profile can be referenced with the $custom_claim operator:
If the referenced field is not present on the user’s profile, the claim is omitted from the token (rather than being set to null).
Profile claims are resolved at every token issuance, so updates to a user’s profile are reflected in the next access token without requiring re-authentication.

Nested claims

Mapping objects can be nested arbitrarily. Anything that is not a $input/$type or $custom_claim template is treated as a plain nested object:

Available inputs

The following template names can be used with $input. Each input has a fixed set of supported $type values.

Type conversions

If an input has no value at token issuance time (for example the user has no email identifier yet), the claim is omitted from the token.

Reserved claims

The following claims are reserved by the JWT specification and cannot be used as top-level keys in your mapping. They are managed by Prelude and would be stripped or rejected: iss · sub · aud · exp · nbf · iat · jti · sid · scope Attempting to set any of them at the root level returns 400 invalid_claim_override. They can still appear as keys inside nested objects (e.g. "metadata": { "iss": "..." }).

Managing the configuration

Each application can have at most one claims mapping configuration. The Management API exposes the standard CRUD operations.
1

Create the configuration

Returns 201 Created with the saved configuration. If a configuration already exists, the request fails with 409 claims_mapping_config_already_exists — use PUT instead.
2

Update the configuration

Replaces the existing configuration entirely. Existing sessions pick up the new mapping on their next refresh.
3

Read the configuration

Returns { "config": null } when no configuration exists.
4

Delete the configuration

Returns 204 No Content. Future access tokens will only contain the standard JWT claims.

Errors

Validation rules

When you submit a mapping, Prelude validates the structure before storing it:
  • A template object using $input must also include $type, and only those two keys.
  • A template object using $custom_claim must contain only that key.
  • $input, $type, and $custom_claim values must be strings.
  • The $input value must match one of the names in Available inputs.
  • The $type value must be one of the types listed for that input.
  • Reserved JWT claims cannot appear at the root level.
Hardcoded scalar values (strings, numbers, booleans) are not validated for shape — anything JSON-serializable is accepted.

Verifying tokens

Custom claims are signed alongside the standard JWT claims, so verifying a token has not changed: fetch the public keys from your application’s JWKS endpoint and verify the signature as usual. Once the signature is valid, the custom claims you configured can be read straight from the JWT payload.

What’s next?

JWKS

Verify the signature of access tokens issued by the Auth API.

Claims Configuration API

Full API reference for managing the claims mapping configuration.