Skip to content

Conversation

nicknisi
Copy link
Member

@nicknisi nicknisi commented May 22, 2025

This pull request introduces functionality to extract and handle custom claims from access tokens, along with corresponding tests and updates to the codebase. The key changes include the addition of the getCustomClaims function, a new useCustomClaims React hook, and unit tests to ensure proper behavior.

New functionality for custom claims:

  • getCustomClaims function: Added a utility function in src/session.ts to extract custom claims from a JWT while filtering out standard claims. This function supports both direct access token input and session-based token retrieval.
  • useCustomClaims hook: Introduced a React hook in src/components/useCustomClaims.ts to provide custom claims in React components by decoding the access token and excluding standard claims.

Fixes #253
Fixes #235

@nicknisi nicknisi requested a review from a team as a code owner May 22, 2025 21:09
@nicknisi nicknisi requested a review from stanleyphu May 22, 2025 21:09
@nicknisi nicknisi requested a review from cmatheson May 27, 2025 16:35
@nicknisi nicknisi merged commit 4daa96f into main May 27, 2025
4 checks passed
@nicknisi nicknisi deleted the nicknisi/custom-claims branch May 27, 2025 18:24
@kkajla12 kkajla12 mentioned this pull request Jun 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

user.metadata is missing JWT access
2 participants