I came across this post - Structuring user data by email address or by user ID. I am using a custom SQL backend where I use email Id to identify a user. As explained in this document - https://firebase.google.com/docs/auth/admin/verify-id-tokens I am verifying the Id token and extracting the email id, INSTEAD of UID. I don't see any real need for using the UID to identify a user. Any thoughts on why to use UID in my case?
Asked
Active
Viewed 75 times
0
-
The other question you linked to already has your answer - don't use email address as a unique ID, since it can change over time. – Doug Stevenson Oct 13 '19 at 19:00
-
I have added some comments below. thx for you help. – god599 Oct 13 '19 at 20:22
2 Answers
0
Emails are changable in firebase authentication, a user can change their email id but never their user id, so it's better to use the user id, so no matter what the user changes they can always stay linked to their data.

ChoopTwisk
- 1,296
- 7
- 13
0
Email addresses change over the lifetime of a user. Think of email addresses you had and don't use anymore, such as your email address in college, or the one with parts in it that would come across rather immature when you'd mail a potential employer from it.
If you think none of these apply to your use-case, you can of course use the email address as a unique identifier for the user. But in practice I've often seen developers revert from that over time.

Frank van Puffelen
- 565,676
- 79
- 828
- 807
-
Per my understanding, one UID is assigned to an email, and can never be reassigned when the email ID changes. Is there a way I can update an email to point to the the same UID? Typically, my users use their email to login, which maps to a firebase UID. In the event of someone updating their email ID, the original UID is useless anyway. – god599 Oct 13 '19 at 20:06
-
Sorry it turns out that email addresses can be updated to point to their original UID-https://stackoverflow.com/questions/39909964/how-to-change-email-in-firebase-auth – god599 Oct 13 '19 at 20:16