I’m working on a React Native app that uses AWS Cognito for authentication with aws-amplify library. I am currently implementing the “Forgot Password” feature.
In the process of resetting a user’s password, I can call:
await confirmResetPassword({
username: "[email protected]",
confirmationCode: "123456",
newPassword: "hunter3",
});
This function expects both the confirmation code and the new password in a single call.
However, I’d like to first verify the confirmation code (to check if it’s valid), and then, once the code is verified, prompt the user to set a new password.
Is there any way in AWS Cognito (using aws-amplify or any other method) to verify the confirmation code separately, without providing the new password right away? Ideally, I’d like to pass just the username and confirmationCode, and get a response on whether the code is valid.
Any suggestions or alternative approaches are appreciated!