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

Hiren Makwana picture Hiren Makwana · Jul 10, 2019 · Viewed 7.5k times · Source

My app creates a custom attribute "userType" for each new signed-up user. Now I would like this "userType" claim/attribute to be added to the JWT access token whenever the user signs in or the token gets refreshed.

Is there an option to tell cognito to add my custom claim/attribute to the JWT access token? (Without a pre token generation Lambda)

Answer

stackOp picture stackOp · Jun 15, 2020

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.