1
votes

I am using Firebase Unity. I found that in a separate run of the app if you initialize FirebaseApp with the same string name, you can get the previous run's FirebaseAuth's CurrentUser and I can see the UID. I can even preserve 2 CurrentUser by multiple FirebaseApp instance (seems to be linked by string name)

This way I can use SignInAnonymously in an intended way, to onboard the player and let him play as many days or as many app run as he wants until he want to commit to the game by providing e-mail and password for LinkWithCredentialAsync.

I also found that if you uninstall the app or clear app data in the Settings of Android, the auth is gone. But app updates preserve the auth. Understandable.

But what I worried is that can the preserved auth expires on its own? For example the player played the game last year with anonymous ID without committing to linking to e-mail credential. If he come back a year later can he still access the same account? (The app is not reinstalled, just upgraded.) I don't see any info in the docs about this.

1

1 Answers

2
votes

I also found that if you uninstall the app or clear app data in the Settings of Android, the auth is gone.

That's correct. Firebase Anonymous Authentication accounts does not persist across application uninstalls. If you uninstall the application, everything that was saved locally will be deleted, including the anonymous auth token that identifies that account.

But what I worried is that can the preserved auth expires on its own?

Anonymous auth token that identifies a user account don't expire. Firebase doesn't remove the token automatically or in any other way because it doesn't really know if a user is still storing data linked to that anonymous account.

For example the player played the game last year with anonymous ID without committing to linking to e-mail credential. If he come back a year later can he still access the same account? (The app is not reinstalled, just upgraded.)

If the player did not uninstall the app and he also did not clear the cache then he will definetely be able to play again with the same account.