Reputation: 1316
As per docs says https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_ForgotPassword.html If the user has not yet verified his email or phone number then
Auth.forgotPassword(username)
should return some error message. as written in documentation
If neither a verified phone number nor a verified email exists, an InvalidParameterException is thrown.
but it's not raising an exception, instead, I receive a success response.
"CodeDeliveryDetails":{"AttributeName":"email","DeliveryMedium":"EMAIL","Destination":"m***@g***.com"}}
I dont receive the email though.
what can be the reason ?
Upvotes: 7
Views: 1664
Reputation: 1418
You need to make sure the email attribute for user is verified
Upvotes: 0
Reputation: 191
@ryan-hines Oh my god, thank you! I've been struggling with this for days.
We had a very similar issue:
"UserMigration_ForgotPassword"
In the newer Cognito UI, we had to go into:
Now the UI properly shows a failure when our lambda throws an error.
Upvotes: 1
Reputation: 81
I was seeing the same issue. It turned out to the related to this:
Use the PreventUserExistenceErrors setting of a user pool app client to enable or disable user existence related errors.
mentioned here: https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pool-managing-errors.html:
After changing that setting on the user pool to 'Legacy' from 'Enabled' I started seeing a 400 response:
{
"__type": "UserNotFoundException",
"message": "Username/client id combination not found."
}
Upvotes: 8