Reputation: 29
I'm using Firebase Authentication. I have a phone verification. Suppose some user forgot his/her password while he/she is signed out.
After phone verification, I want to allow him/her to change his/her password. (He/she is not signed in).
I can't use getCurrentUser()
because he is not signed in.
User's account is created with email(email sign in method). but verification is made with phone number.
So, how can I do this??
Upvotes: 0
Views: 55
Reputation: 317740
You can change a user's password with updatePassword(). That is a method of the class FirebaseUser. You can only get one of these objects when the user is signed in. So, it's not possible to have a user change their own password unless they are signed in.
The only alternative to this is to build a "back door" that allows a user to fill out some form and submit it to your backend, so that you can use the Firebase Admin SDK to update the user account directly, bypassing the normal security concerns. The Admin SDK only runs on backends, and not in client apps.
Upvotes: 1