I've create an React application using AWS Amplify, and I getting and error with recover password feature.
When I put e-mail and call forgot password function, I'm receiving status code 400 with message: NotAuthorizedException: Contact administrator to reset password.
I checked my App Role, and I have "cognito-idp:AdminResetUserPassword" permission.
That's my code:
const sendCode = (event,email) => {
event.preventDefault();
const cognitoUser = new CognitoUser({
Username: email.toLowerCase(),
Pool: UserPool
});
// call forgotPassword on cognitoUser
cognitoUser.forgotPassword({
onSuccess: function(result) {
alert(`Verification code sent to: ${email}!`)
},
onFailure: function(err) {
alert(`Error while send verification code to: ${email} - ${err}`);
},
});
}
How can I get that permission?
I solved this problem, and the solution is simple. The feature of recover accounts was disable, I just enable it and it works.
It means your account recovery is disabled in the user-pool.
You can use AWS Console to enable the Self-service account recovery. You can find this setting inside the User Account Recovery section of the Sign-in experience tab in your user-pool, through AWS Console.
User Account Recovery
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