Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to access authUser.uid from firebase.js #44

Open
MattHeslington opened this issue Jan 6, 2021 · 2 comments
Open

How to access authUser.uid from firebase.js #44

MattHeslington opened this issue Jan 6, 2021 · 2 comments

Comments

@MattHeslington
Copy link

Hello,

Apologies if this is badly worded or an entirely stupid question. I have followed this fantastic tutorial and it's working perfectly. I would now like to allow logged-in users to post content. This is all fine, but I need to name each user's collection something like .collection(${currentUser.uid}). What's the best way to access this value in my component, please?
Many thanks for any help.
Matt

@erikswed
Copy link

erikswed commented Jan 6, 2021

Here's a screenshot of of an Android app using Cloud Firestore showing the user collection with unique id's. As you see user collection document id is unique as in phone number or e-mail!
Here's how to Get data with Cloud Firestore

image

@MattHeslington
Copy link
Author

Here's a screenshot of of an Android app using Cloud Firestore showing the user collection with unique id's. As you see user collection document id is unique as in phone number or e-mail!
Here's how to Get data with Cloud Firestore

image

Hello Hans,
Thank you so much for your reply. I'm sorry I didn't phrase my question correctly. I was wanting to know how, through code, do I access the authUser.uid found in firebase/firebase.js

authUser = {
uid: authUser.uid,
...
};

I would like to be able to create unique collections in Firestore for each user using their current user id from the Realtime Database. I'm at a loss at the moment. I assume it's either through using the { AuthUserContext } import or the {withFireBase } import but I'm unsure of the actual code.
Sincere regards,
Matt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants