Benjamin Scholtz
Benjamin Scholtz

Reputation: 823

Firebase user no longer anonymous after calling updateProfile() method

Within the Android app I create an anonymous user, and later migrate this user's data to a Google/Facebook auth account when the user decides to sign-in.

This has been working fine until using the FirebaseAuth updateProfile() method, whereafter the user is no longer anonymous when you call the isAnonymous() method.

From the Firebase API docs - https://developers.google.com/android/reference/com/google/firebase/auth/FirebaseUser.html#isAnonymous() :

isAnonymous():

Returns true if the user is anonymous; that is, the user account was created with signInAnonymously() and has not been linked to another account with linkWithCredential(AuthCredential).

FirebaseUser updateProfile() method:

FirebaseAuth.getInstance().currentUser?.updateProfile(
                UserProfileChangeRequest.Builder()
                .setDisplayName("Anonymous User")
                .build())

The above method is called so that later in the app I can check the anonymous user's display name and write it to the database etc.

According to the API docs a user is considered anonymous until such stage that linkWithCredential() is called or the user signs in with an auth provider method, so why does the updateProfile() method make the anonymous user no longer anonymous?

Upvotes: 5

Views: 791

Answers (1)

Frank van Puffelen
Frank van Puffelen

Reputation: 598837

firebaser here

This is a bug in the Firebase Android SDK. It's been there since version 9.0 was launched around I/O 2016. Now that we know about it, it will be fixed in an upcoming version (although I don't know which version that will be yet).

Upvotes: 5

Related Questions