Firebase - unique identifier for each user

I am creating a firebase based android app that includes multiple users who authenticate and log into the app. I want to provide a unique one for each user that authenticates and logs in, and that won't change even if the user reinstalls the app, so that I can use and rely on this key to make a separate json branch for that particular user in the database at based on this I would.

I searched for the docs I found user.getUid()

and user.getToken()

. I am confused by these two that will help me consider my situation.

+3


source to share


1 answer


Definitely use user.getUid()

. It is Firebase standard practice to use this UID to create a dedicated JSON branch for that user (in the database) as you described.



This UID will remain the same even if the user uninstalls your app. As soon as he logs in again, he will be assigned the same UID.

+5


source







All Articles