extraClaimsProvider property
Future<Map<String, dynamic> ?> Function(Session session, JwtContext context)?
extraClaimsProvider
final
Optional provider for extra claims to add to refresh tokens.
This function is called during refresh token creation and allows developers to dynamically add custom claims to the token. The function receives the session and an JwtContext containing contextual information about the authentication, enabling it to fetch any additional information needed and decide how to merge with existing claims.
The returned map contains extra claims to be included in the refresh token payload. These claims will be embedded in every access token (including across rotations) and sent along with any request.
Claims must not conflict with registered claims or Serverpod's internal claims (those starting with "dev.serverpod.").
Implementation
final Future<Map<String, dynamic>?> Function(
Session session,
JwtContext context,
)?
extraClaimsProvider;