Using R, I am trying to read the Firebase authentication records created by users for our project, projectID. To be clear, I do not wish to read, nor can I read, the user pswd, just the Firebase authentication ID, known as the User UID.
Firebase creates a unique UID when a user record is created. This in turn populates a collection, call it collectionID, where the key to collectionID is the Firebase authentication User UID. Other information about the user's use of our application is stored within this collection.
I can read the collectionID using the Firestore library created by Luis Rodriguez - github("luizmirodriguez/FireStore") - as follows:
fireStore.download(projectID,collectionID,auth$credentials$access_token).
I cannot download the authentication records shown in Firebase Console with R today. Does anyone know how to do this?
It may be as simple as knowing the name of the collection (authentication, authentication/users, authentication/users_uid all produce errors).
Any help appreciated
Related
I have my backend hosted in firebase. Whenever a new user registers I create a new account in my firestore collection. Each user will be identified by a unique uid generated by firebase. Is it possible with enough users to generate the same uid and hence write over another user's data when registering? Or does firestore have any built-in measures to prevent this from happening? Thanks in advance.
Firebase Auth guarantees that each user will have a truly unique ID within your project. There is nothing you have to do. Just accept the UID it generates.
I have successfully added some users' information in firestore documents.
And I have a flutter app where the Client can enter some information after registration, I want to use that information provided to match/link the authenticated user to firestore using a field in the user document, is that possible?
note:
- the data in firestore is created before the user registration. which means the registered user uid is different from the one created in firestore
I would appreciate help in this regard, what is the proper code to do so?
I'm pretty new to this.
user in firestore document id
user uid from firebase
you can create another collection and store other info with the document with documentId as same as uid.so that you can query the collection with the authenticated user with uid.
Is it possible to reference user objects in Firestore like a regular document from collection ? I've created a sample of fake users for test in the Authentication section, and I'd like to reference them in a collection.
Their is the reference field :
The id seems correct, however calling a db.doc() with this reference as a parameter returns an empty document (snapshot.exists returns false).
The database 'users' isn't present in my collections since it is handled by Firestore authentication system, but I was wondering if their was a way to access it, similar to regular documents.
You seem to be mixing up two products in the Firebase platform:
Firebase Authentication handles user sign-in.
All information about these users is stored in an internal database,
that you can only access through the Firebase Authentication APIs.
Cloud Firestore stores data that you put in it.
Firebase Authentication does not automatically create any user data in Firestore when a user is created. If you want such data in Firestore, you'll have to create it yourself, either in your application code, or in Cloud Functions in response to the user-created event.
Within Cloud Firestore there is no type that is a "reference to a Firebase Authentication user". But if you store user-specific documents in Firestore, you can use its Document Reference type to reference those user-specific documents.
I just ran a test of Auth.auth().signInAnonymously and printed the uid of the anonymously created User. I then looked up that ID in my Users collection and didn't find a record. Is that User document only created when you convert them to non-anonymous?
Thanks.
Is that User document only created when you convert them to non-anonymous?
No, the user will appear in the database only when you'll add it. Firebase authentication does not write any data to your Cloud Firestore database.
I am using firebase auth for a project. Since we don't want to be in charge of handling passwords, and eventually want to add social login we're going to use FireBase.
We have an .NET WEB API set up right now with its own database. In this database some tables have reference to user's. Example: Order table would need a customer id.
Since we're only using Firebase Auth we're thinking about storing some user data in our database. Specifically:
FirstName | LastName | Role.
Would it be okay to store the Firebase UID in our tables as well, or is the a different parameter we should be using?
Yes, what you want is a unique identifier for each user and sounds like Firebase's auth UID is unique across the same project. Based on Firebase's document:
getUid() Returns a string used to uniquely identify your user in
your Firebase project's user database.
Also check this answer:
Is Firebase UID unique across multiple apps?
Yes, it's very common to store Firebase Auth UIDs in a database to store per-user information.