My question is how does Firebase generate the Uid? Is it generated from the app installation on the cellphone or maybe it is based on the login provider via email, Facebook, Google or the other ones that Firebase provide?
Firebase users have a fixed set of basic properties—a unique ID, a primary email address, a name and a photo URL—stored in the project's user database, that can be updated by the user (iOS, Android, web).
It's best to use the Firebase Authentication UID as a Cloud Firestore document ID in this case. You might be tempted to use an email address as a per-user document ID, but I don't recommend that at all, as email addresses can change over time. UIDs will never change.
The uid to assign to the newly created user. Must be a string between 1 and 128 characters long, inclusive. If not provided, a random uid will be automatically generated.
UUID is autogenerated based on timestamp and some entropy. UUID's can be sorted based on creation time, this helps to maintain indexes in Firebase.
UUID is not some hash of for example the email address, or facebook id or other. By removing all meaning from the uid itself, it is not dependent on any underlying properties and those properties can freely changed.
If you want to use custom UID you need to be consistent. It is recommended to not tight together user id creation and login property of some sort because the property can change, and you will have inconsistent user id.
The Firebase User ID (often called uid) is an opaque identifier for a user account. It has no connection to the underlying identity provider(s) for the account and should be treated as an opaque value.
As per IndieWeb
“Opaque” is a term often used to refer to data such as URIs or other identifiers. An identifier is opaque if it provides no information about the thing it identifies other than being a seemingly random string or number.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With