I have clicked "Reset Password" in Cognito and now when I login I get "PasswordResetRequiredException
", how should I handle this? I cant find anything in the docs that tell me what should I do?
check this http://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-using-import-tool-password-reset.html
you need to call ForgotPassword()...
I figured out the exact way that you can handle this on (onFailure) callback:
// Create a cognito user instance
const cognitoUser = new AmazonCognitoIdentity.CognitoUser(userData);
// Trigger to authenticate the user
cognitoUser.authenticateUser(authenticationDetails, {
onFailure: function(err) {
if (err.code == "PasswordResetRequiredException") {
// Confirm user data
cognitoUser.confirmPassword(
"", // Put your verification code here
"", // Here is your new password
{
onSuccess: result => {
// Everything worked as expected
},
onFailure: err => {
// Trigger failure
}
}
);
} else {
// Trigger failure
}
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With