Home > Back-end >  AWS Cognito - Reset User Password by sending the code and link to the reset form
AWS Cognito - Reset User Password by sending the code and link to the reset form

Time:01-22

I'm trying to implement the next logic in AWS Cognito:

AWS lambda catch CustomMessage_ForgotPassword event,

Lambda function returns HTML template, which contains Reset code and what I'm trying to do is to adding a button with the link, which should redirect user to the Cognito form, where he enter Code new password.

I've create link https://${ENVIRONMENT}/confirmForgotPassword?client_id=${CLIENT_ID}&redirect_uri=${REDIRECT_APP}&scope=openid profile email&response_type=token&user_name=${userName}&confirmation_code={####}.

When I click on the link inside email I navigate to the page, which shows me an error:

enter image description here

I would like to navigate:

enter image description here

The question: Is it possible to send a code with the constructed link to the form by email?

CodePudding user response:

Lambda function returns HTML template, which contains Reset code and what I'm trying to do is to adding a button with the link, which should redirect user to the Cognito form, where he enter Code new password.

I don't think this is possible. The person should already be on that page, having just clicked the "reset password" link, which triggered your Lambda function to run, so they shouldn't need another link to the same page. Or they just logged in and landed on the reset page, because you flagged their account as needing to reset the password. In either case, they are already on the page that is waiting for them to read the code your Lambda function generated, and type it into the input field. That page is not designed to be refreshed, or loaded directly, as it could pose a security risk if bots could spam that page with different codes.

  • Related