How to allow my user to reset their password on Cognito User Pools?

后端 未结 3 1931
难免孤独
难免孤独 2021-02-05 03:47

So in my app I obviously want to provide the means for users to reset their passwords. The issue I\'m having though is that the new documentation for User Pools is pretty ambigu

3条回答
  •  萌比男神i
    2021-02-05 04:35

    Resetting the password with forgot password flow has two steps:

    1. Start the process by requesting for a verification code from the service. A code will be delivered to the user's phone/email.
    2. Set the new password using the delivered verification code.

    Use these two functions to perform the above steps and reset the password:

    1. cognitoUser.forgotPassword(): This will start the forgot password process flow. The service generates a verification code and sends it to the user. The "data", returned through callback.inputVerificationCode(data), indicates where the verification code was sent.

    2. cognitoUser.confirmPassword(): Use the delivered verification code with this function to set a new password.

提交回复
热议问题