简体   繁体   中英

How can I allow a user to change his password if they are signed out?

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??

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM