The server module exports utility functions for working with ID token claims and other authentication-related operations.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/auth0/nextjs-auth0/llms.txt
Use this file to discover all available pages before exploring further.
filterDefaultIdTokenClaims
Filters out default OIDC claims from an ID token, leaving only custom claims.The ID token claims object to filter
Object containing only custom claims (default OIDC claims removed)
Example
Use Case
This utility is helpful when you want to extract only the custom claims from an ID token, such as:- Application-specific user metadata
- Custom authorization data (roles, permissions)
- Business logic data
According to OIDC best practices, custom claims should use namespaced URIs (e.g.,
https://my-app.com/claim-name) to avoid conflicts with standard claims.DEFAULT_ID_TOKEN_CLAIMS
An array constant containing the standard OIDC ID token claim names that are filtered byfilterDefaultIdTokenClaims.
Default Claims List
The following claims are considered default OIDC claims and will be filtered out:| Claim | Description |
|---|---|
iss | Issuer identifier |
sub | Subject identifier (user ID) |
aud | Audience (client ID) |
exp | Expiration time |
iat | Issued at time |
auth_time | Authentication time |
nonce | Nonce value |
acr | Authentication Context Class Reference |
amr | Authentication Methods References |
azp | Authorized party |
at_hash | Access token hash |
c_hash | Code hash |
s_hash | State hash |
sid | Session ID |
Example
Usage with beforeSessionSaved Hook
A common use case is to extract custom claims when saving the session:See Also
- Session Configuration - Configure session behavior
- beforeSessionSaved Hook - Customize session data
- User Type - User object structure