Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to migrate firebase anonymous user to authenticated user in Flutter

In my app, user can login as guest user. I want to authenticate the guest user with email & password, or with google. The user id should remain the same after authentication. How to do that?

like image 553
Newaj Avatar asked Dec 12 '25 14:12

Newaj


1 Answers

To upgrade an anonymous account to an account with credentials, you create a new account with the sign-in method that you want to use, and then link the anonymous account and that new account together as shown in the Firebase documentation.

So in Flutter you'd use the relevant auth provider's getCredential method (e.g. Facebook or Google) and then call linkWithCredential on the anonymous user object.

like image 54
Frank van Puffelen Avatar answered Dec 15 '25 05:12

Frank van Puffelen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!