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 ?
I was seeing the same problem. It turned out related to this:
Use the PreventUserExistenceErrors setting of a user pool application client to enable or disable errors related to user existence.
Mentioned here: https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pool-managing-errors.html :
After changing that setting in the user group to 'Legacy' from 'Enabled', I started seeing a 400 response:
{ "__type": "UserNotFoundException", "message": "Username/client id combination not found." }@ryan-hines oh my god thank you! I have been struggling with this for days.
We had a very similar problem:
"UserMigration_ForgotPassword"In the new Cognito UI, we had to enter:
The UI now correctly displays a failure when our lambda throws an error.