How to setup custom email template for confirmation email of cognito password reset flow?

0

I want to use custom email template for password reset confirmation from cognito. Once password reset api is called, cognito sends out confirmation email to verified user email. The email is so simple and it has nothing but confirmation number. I want to put link to change password and images, text describe our business to our user. If I can get a reset password event, then I can use lambda to handle our custom reset password email.

Thanks.

gamgule
asked 8 months ago429 views
1 Answer
0

Hello,

Thank you for posting on AWS re:Post!

I understood that you would like to customize the confirmation email getting sent on password reset to the user.

You can implement this by using custom message lambda trigger, This trigger will get invoked when forgot password action performed. You can refer below AWS reference document for more information on custom message lambda trigger.

https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-custom-message.html

Cognito natively doesn't send password reset link it only sends verification code. However, you can use event that is getting sent to custom message lambda trigger to build the password reset link in below format.

https://yourwebsitedomain/forgot-password?confirmation_code=${event.request.codeParameter}&user_name=${event.userName}

In this case, you need to use custom UI where user will enter new password. On submission of the new password, extract user name and confirmation code from URL query parameter and new password from user input. Use ConfirmForgotPassword API with userpool client ID and extracted parameters to reset the password.

I hope this information will be helpful to you.

Thank you!!

AWS
SUPPORT ENGINEER
answered 8 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions