Set up password change and recovery
Reset password
In order to reset your password, use the resetPassword api - this will send a code to the user attribute configured to receive such a reset code (e.g. email or SMS):
1Amplify.Auth.resetPassword(2 "username",3 result -> Log.i("AuthQuickstart", result.toString()),4 error -> Log.e("AuthQuickstart", error.toString())5);
To complete the password reset process, invoke the confirmResetPassword api with the code you were sent and the new password you want.
1Amplify.Auth.confirmResetPassword(2 "NewPassword123",3 "confirmation code you received",4 () -> Log.i("AuthQuickstart", "New password confirmed"),5 error -> Log.e("AuthQuickstart", error.toString())6);
Change password
A signed in user can update their password using the updatePassword api:
1Amplify.Auth.updatePassword(2 "existingPassword",3 "newPassword",4 () -> Log.i("AuthQuickstart", "Updated password successfully"),5 error -> Log.e("AuthQuickstart", error.toString())6);