Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure 'Pre Token Generation' trigger via CloudFormation?

Pre Token Generation trigger: This Lambda trigger allows you to customize an identity token before it is generated: https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-pre-token-generation.html

I am looking for a way to configure this trigger via CloudFormation. Something like:

UserPool:
  Type: AWS::Cognito::UserPool
  Properties:
    LambdaConfig:
      # Next line does not work:
      PreTokenGeneration: [lambda ARN]

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-lambdaconfig.html

I found docs for other triggers, but this one is missing. Is this a missing feature or just not documented?

like image 265
yokomizor Avatar asked Oct 31 '18 22:10

yokomizor


People also ask

How do I customize an identity token before it is generated?

This Lambda trigger allows you to customize an identity token before it is generated. You can use this trigger to add new claims, update claims, or suppress claims in the identity token.

How to generate pre token in Cognito using lambda function?

Scroll down on this page and choose Pre Token Generation as a Trigger option. Select the Lambda function created in the previous step and save the changes. Create a test-user in Cognito User Pool like below and verify the user email address

What is the difference between the access token and refresh token?

The Access Token grants access to authorized resources. The Refresh Token contains the information necessary to obtain a new ID or access token. In this post we will talk about how to add custom JWT claims to an ID Token generated by a Cognito User Pool using the Pre token Generation Lambda Trigger.

How to override or add custom ID token claims to JWT token?

Through the event [‘response’] [‘claimsOverrideDetails’] key, we can override or add custom ID token claims to the JWT token in this case pet_preference. Return the modified token back.


1 Answers

https://forums.aws.amazon.com/thread.jspa?threadID=268907

It's on their roadmap but there're no news since cognito's cloudformation launch

like image 193
Momo Avatar answered Sep 21 '22 17:09

Momo