Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How constant is the Firebase Anonymous ID

I'm building an app with Firebase Real-Time Database. The app will be mainly offline at first, but we are planning an online update later. I'm planning to use the anonymous sign in, to get an ID for the user and store all his data under this ID:

Auth.auth().signInAnonymously(completion: { (user, error) -> Void })

After signing in I get an ID that looks like something like this: pCfgFOvEYEYvfWHaaaaavKgs8h33

Is it guaranteed that this ID will ALWAYS stay unchanged on a given device? I couldn't find any documentation about this.

like image 293
Wiingaard Avatar asked Dec 17 '17 11:12

Wiingaard


People also ask

Does Firebase uid change?

The format of the auth UIDs generated by Firebase will be changing on Monday, August 17th. We'll be changing from an incremental integer to a UUID (universally unique identifier).

What is anonymous user in Firebase?

You can use Firebase Authentication to create and use temporary anonymous accounts to authenticate with Firebase. These temporary anonymous accounts can be used to allow users who haven't yet signed up to your app to work with data protected by security rules.

Is Firebase uid sensitive?

No its safe to use the uid and recommended, firebase uses auth to authenticate the user and the assign the uid to identify the user across firebase. You will be using uid in your security rules and as well as to identify user info in your db records.

Is Firebase persistent?

Note that Firebase Auth web sessions are single host origin and will be persisted for a single domain only. Indicates that the state will only persist in the current session or tab, and will be cleared when the tab or window in which the user authenticated is closed. Applies only to web apps.


1 Answers

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.

like image 200
Frank van Puffelen Avatar answered Nov 01 '22 22:11

Frank van Puffelen