I have authenticated my user using phone authentication, and the user object that is returned has this long string when I call user.getUid() :
dn27dhJK..... (some long string).
If I authenticate this user on some other device (using my phone number etc), will user.getUid() always be the same ?
EDIT: From the documentation: https://firebase.google.com/docs/reference/android/com/google/firebase/auth/FirebaseUser
public abstract String getUid ()
Also: Google Play services Returns a string used to uniquely identify your user in your Firebase project's user database. Use it when storing information in Firebase Database or Storage, or even in your own backend.
This identifier is opaque and does not correspond necessarily to the user's email address or any other field.
It is unclear if this id remains constant or not.
Represents a user's profile information in your Firebase project's user database. It also contains helper methods to change or retrieve profile information, as well as to manage that user's authentication state.
actually you are on the right way, for unique id you can use user. getUid() this id will always unique for every user as per their register credentials. Token is basically depends on device which will help you into send notification feature.
FirebaseAuth is the gateway to the Firebase authentication API. With it, you can reference Firebase. Auth. FirebaseAuth objects to manage user accounts and credentials. Each Firebase.
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.
If you're using Firebase Authentication in your project:
Remember
Firebase will generate a single unique key(i.e. UID) on registration of a/c whether using Email/Phone number.
This key remain associated to that a/c untill a/c is exist in firebase authentication list.
If your app is uninstalled on phone & then a/c is open in another then we can fetch that key from Firebase cloud auth. service.( UID remain safe).
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