aws-lambdaamazon-cognito

AWS Cognito: Add custom claim/attribute to JWT access token


My app creates a custom attribute, "userType," for each new user who signs up. I would like this "userType" claim/attribute to be included in the JWT access token whenever the user signs in or the token is refreshed.

Is there a way to configure Cognito to automatically add this custom claim/attribute to the JWT access token without using a pre-token generation Lambda function?


Solution

  • Custom attributes are not available in Cognito access token. Currently it is not possible to inject additional claims in Access Token using Pre Token Generation Lambda Trigger as well. PreToken Generation Lambda Trigger allows you to customize identity token(Id Token) claims only.