How Constant Is the Firebase Anonymous Id

How constant is the Firebase Anonymous ID

A user's UID never changes. So after you sign in a user anonymously, the UID will remain the same (even when you call signInAnonymously again), until you call signout, or until the user uninstalls the app.

Is FirebaseUser.getUid() constant for a given user?

When you first verify the phone number (or first sign in with a social provider, or call createUser), a user account is created - and thus a new unique UID id created. From that moment on, that user/phone number will remain associated with that account/UID. No matter if they re-verify on the same or a different device.

If you delete the account, a new account+UID will be generated when you use that same phone number next time.

Firebase - Should I stop using Anonymous Auth in my specific case? (Also, how to delete users)

You don't need to worry about this, Firebase authentication is independent of FCM; the only thing you may need to worry about is token expiration (covered in this question).

So yeah, you can drop anonymous authentication, no problem if the session expires.

Firebase authentication without user's credentials

What you're looking for is Firebase's anonymous authentication. This signs the user into Firebase, without requiring them to enter credentials.

If needed you can later allow the user to sign-in with a supported provider, and link that to their existing (anonymous) account.

Does Firebase anonymous authentication survive when clearing app cache?

No, it will not survive. No data previously saved by the app will survive. The whole point of clearing app data is to make the app behave as if it was newly installed.

Keep Firebase authentication state across iOS devices

There is no way to retain Firebase's anonymous authentication state across app installs, or across devices. The anonymous user's token cannot be restored once it's deleted, and cannot be recreated on another device.

If you need this functionality, consider implementing your own custom identity provider in Firebase Authentication, that for example uses the Apple Id of the user as their identity. This will take part in your client-side code and in a server-side component.



Related Topics



Leave a reply



Submit