Issue
I'm sorry if my question is basic question...
is UID in firebase automatically created when we implement .setUid()
at the first user sign-up account? and if we are login to that user account and implement .getUid()
, can we retrieve the same UID?
I use Android Studio and Kotlin as programming language
Solution
No matter how you implement authentication on your app, firebase will automatically set a uid for each account created. If you go to the auth section of your firebase console and manually add an account, you will see on the right hand side a uid generated for that account.
To reference this uid within your code the uid does not need to be stored in any database solution for the uid is attatched to the account within FirebaseAuth..
To pull the uid for reference once the user has signed in, first you need to set the auth global variable..
private lateinit var auth: FirebaseAuth
Then anywhere within the scope of your functions you can set your uid reference variable like this..
val myUid = FirebaseAuth.getInstance().currentUser.uid;
Answered By - Kyra Posey
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.