auth-js
auth-js copied to clipboard
How user can recover password if user is authenticate with phone number?
I have authenticate user from phone number and password now I'm facing a issue that I can't recover password if user have forgotten it.
Thanks for raising this up @Rayyanmaq1, we should create a function on gotrue-js to handle password resets for phone and password signups.
Currently, a workaround for this would be to use the signIn({phone})
method which will send an otp to the user's phone number. From there, you can use the verifyOTP
method to verify the otp and sign the user in.
Once the user is signed in, they can reset their password by updating it via the updateUser endpoint
I know this but if user is authenticated with phone number and password if he want to reset the password how he can do it.
Could you elaborate more on what you mean by "reset the password" please?
A password reset is the same as updating the password once the user is authenticated. If the user has forgotten the password, then the only way to authenticate the user is via an otp. The user has to be authenticated first before they can change the password.
Hey @Rayyanmaq1, please let us know if you're still facing this problem, as mentioned, if you wish to reset a user's password through a phone number, these are the following steps:
- Sign-in the user with phone OTP
- Redirect the user to a reset password page
- Call the update method or updateUser (if you're using v2) to update the user's password.