filterDefaultIdTokenClaims
Filters out default OIDC claims from an ID token, leaving only custom claims.Record<string, any>
required
The ID token claims object to filter
Record<string, any>
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: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