简体   繁体   中英

Firebase Anonymous Auth: Restore account

I have the following scenario: A user is authenticated anonymously with firebase auth. He then signs in into an existing account with email & password. Then, he signs out of that account again. Now, I want to recreate the anonymous account he has used before.

Is it somehow possible to store the anonymous credentials locally on the device and to use them later for signing in into the anonymous account again? I guess it would be sufficient to save the access / refresh token, but does firebase auth offer an API for that?

There is no way to restore a Firebase Authentication anonymous user's UID once it's been lost. All you can do at that point is create a new anonymous account for them, but that then won't have the history of the previous account.

What you'll typically want to do is link the email+password account to the anonymous ID when the user signs in.

Then if the user ever wants to disconnect their email+password credentials, you can unlink the two accounts .

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