I started exploring AWS cognito for my dummy ios application, although I am getting a confirmation link in email during new user signup, and clicking on it verifies the email correctly.
Do we have same functionality for forgot password i.e. getting a link instead of codes and redirect it to my dummy website where only thing user needs to do is enter is new password.
Thanks in advance.
Its possible I have achieved this in my project.
Its done via triggers in aws cognito.
In Custom message trigger set lambda function you want to trigger.
const AWS = require('aws-sdk');
exports.handler = (event, context, callback) => {
var CustomMessage_ForgotPassword = `<style>
p {
display: block;
margin-block-start: 1em;
margin-block-end: 1em;
margin-inline-start: 0px;
margin-inline-end: 0px;
}
</style>
<div id=":x9" class="a3s aXjCH " role="gridcell" tabindex="-1"><p>Hello,</p>
<p>Follow this link to reset your Password. </p>
<p><a href="https://your-website.com/reset-password?confirmation_code=${event.request.codeParameter}&user_name=${event.userName}"> Reset Password </a></p>
<p>If you didn’t ask to change password, you can ignore this email.</p>
<p>Thanks,</p>
<p>Your website team</p>
</div>`
if (event.triggerSource === "CustomMessage_ForgotPassword") {
event.response.emailMessage = CustomMessage_ForgotPassword;
}
callback(null, event);
};
Then on your website make one route which will handle this code.