Custom Token Claims
Learn how to embed custom claims directly into your application tokens.
Overview
Custom claims let you include information about an authenticated user or OAuth2 client in access tokens, ID tokens, and responses from the UserInfo Endpoint. For example, you can include a user's email, a tenant's display name, or the roles assigned to the authenticated subject.
You define custom claims at the application level. Each definition has three parts: a name that identifies the claim, one or more destinations where Wristband returns it, and a path expression that tells Wristband where to read its value.
Wristband groups custom claims in a JSON object named custom_claims within each selected token payload or UserInfo response. Each entry pairs the claim's configured name with the value Wristband resolves from its path expression.
Custom Claim Name
The claim name becomes a key in the custom_claims object. For example, if you name a claim department, your application can read its value at custom_claims.department.
Claim names must meet the following requirements:
- Uniqueness: Each name must be unique within the application (case insensitive). Wristband treats
departmentandDepartmentas the same name. - Length: Up to 20 characters.
- Allowed characters: Letters, numbers, hyphens (
-), and underscores (_).
Destinations
Choose one or more destinations for each custom claim based on where your application needs its value.
| Destination | When to use it |
|---|---|
| Access Token | Your application needs additional claims regarding the authenticated subject when processing an API request that includes the access token. |
| ID Token | Your application needs additional claims about the authenticated user at sign-in and cannot retrieve it from the UserInfo Endpoint. |
| UserInfo Response | Your application needs additional claims about the authenticated user after sign-in. |
Prefer the UserInfo Response for Custom User ClaimsIf your application needs additional user claims after sign-in, prefer UserInfo Response under Include In instead of ID Token. Select ID Token only when your application has a specific requirement for the claims to be in the ID token.
This follows the OpenID Connect pattern for standard claims. When the sign-in flow issues an access token, UserInfo is the destination for claims requested through the
profile,address, andphonescopes. See OpenID Connect Core §5.4.
Path Expressions
A path expression tells Wristband where to get a custom claim's value.
The table below lists the supported paths for role names and direct user and tenant fields. For custom metadata values, see Custom Metadata Path Expressions.
| Path expression | Value |
|---|---|
role.name | The authenticated subject's assigned role names, returned as an array of strings. |
user.id | The authenticated user's ID. |
user.email | The authenticated user's email address. |
tenant.id | The associated tenant's ID. |
tenant.name | The associated tenant's name. |
tenant.displayName | The associated tenant's display name. |
Custom Claims in Client Credentials Access TokensWhen an OAuth2 client authenticates using the
client_credentialsgrant, the client is the authenticated subject. Wristband omits claims withuser.paths from the access token because no user is involved.For a tenant-level client,
tenant.paths reference the tenant that owns the client. For an application-level client, Wristband also omits claims withtenant.paths because the client has no associated tenant.
Custom Metadata Path Expressions
Path expressions can also be used to read values from user and tenant custom metadata. A custom metadata path expression starts with a prefix that selects the metadata object.
| Prefix | Metadata source |
|---|---|
user.publicMetadata | The authenticated user's public metadata. |
user.restrictedMetadata | The authenticated user's restricted metadata. |
tenant.publicMetadata | The associated tenant's public metadata. |
tenant.restrictedMetadata | The associated tenant's restricted metadata. |
Add a period after the prefix, followed by the field path. For a nested field, separate each field name with a period. The field path can contain up to four segments after publicMetadata or restrictedMetadata.
For example, in user.publicMetadata.subscription.plan, the prefix user.publicMetadata selects the authenticated user's public metadata. The field path subscription.plan reads the plan field inside the subscription object and uses it as the claim's value.
Missing Metadata FieldsIf a custom metadata path references a missing field, Wristband includes the claim in the
custom_claimsobject with a value ofnull.
Custom Claim Examples
These examples use the same custom claim definitions. Each JSON excerpt shows the custom_claims object in the specified token payload or UserInfo response.
| Custom Claim Name | Include In | Path Expression |
|---|---|---|
role_names | Access Token | role.name |
tenant_name | Access Token, ID Token | tenant.name |
department | Access Token, UserInfo Response | user.publicMetadata.department |
User Sign-In
A user in the acme tenant signs in with the editor and viewer roles. Their public metadata contains the following JSON object: {"department": "engineering"}.
Access token payload
{
"custom_claims": {
"role_names": ["editor", "viewer"],
"tenant_name": "acme",
"department": "engineering"
}
}ID token payload
{
"custom_claims": {
"tenant_name": "acme"
}
}UserInfo response
The application calls the UserInfo Endpoint with the user's access token.
{
"custom_claims": {
"department": "engineering"
}
}User Sign-In With Missing Metadata
A user in the globex tenant signs in with the viewer role and empty public metadata ({}). The department path references a missing field, so Wristband includes the claim with a value of null in both configured destinations.
Access token payload
{
"custom_claims": {
"role_names": ["viewer"],
"tenant_name": "globex",
"department": null
}
}ID token payload
{
"custom_claims": {
"tenant_name": "globex"
}
}UserInfo response
{
"custom_claims": {
"department": null
}
}Tenant-Level OAuth2 Client
An OAuth2 client owned by the acme tenant has the reader role and authenticates using the client_credentials grant. Wristband resolves role_names from the client's role assignments and tenant_name from the tenant that owns the client. It omits department because that claim requires an authenticated user.
Access token payload
{
"custom_claims": {
"role_names": ["reader"],
"tenant_name": "acme"
}
}Application-Level OAuth2 Client
An application-level OAuth2 client has the reader role and authenticates using the client_credentials grant. Wristband resolves role_names from the client's role assignments. It omits department and tenant_name because those claims require user and tenant context, respectively.
Access token payload
{
"custom_claims": {
"role_names": ["reader"]
}
}Configuring Custom Claims in the Dashboard
- From the Dashboard Home page, select the application you want to configure.
- In Application View, navigate to Security → Token Settings.
- In the Custom Token Claims section, enter a Custom Claim Name.
- Under Include In, select one or more destinations for the claim.
- Select a Path Expression.
- Click Create Claim.

Figure 1: Create a custom claim in Token Settings.
Creating a Custom Metadata Claim
Use the custom claim form to create a claim from a user or tenant custom metadata field.
- Enter a Custom Claim Name and select one or more destinations under Include In.
- From the Path Expression dropdown, select a metadata prefix, such as
user.publicMetadata. - In Metadata Path, enter the field path that follows the prefix. For example, if the full path is
user.publicMetadata.department, enterdepartment. - Click Create Claim.

Figure 2: Select a metadata prefix and enter the field path.
Viewing Existing Custom Claims
The table at the bottom of the Custom Token Claims section lists the application's existing claims.

Figure 3: View the application's existing custom claims.
Deleting Custom Claims
- In the custom claims table, open the More Options (⋮) menu for the claim you want to delete.
- Select Delete Custom Claim.

Figure 4: Delete a custom claim from its More Options menu.
Updated 5 days ago