I am trying to make a db model on fire base but I didn't understand the user authentication quite yet in mongo db you can make a document that has all the user data like email for example and passwords in addition to that user data, but in firebase the user authentication is a separate data base , can i make users document that include users data and authentication with in the fire cloud db ? or at least can I connect AUTH and db together ?
Asked
Active
Viewed 154 times
1
-
1Are you using Firebase auth? If yes, then you don't have to manage users passwords and info yourself. To link a user with their documents, you can store their UID in the db – Dharmaraj Feb 19 '22 at 06:25
-
As already Dharmaraj asked, are you using Firebase Authentication? Please respond with @AlexMamo – Alex Mamo Feb 19 '22 at 10:24
-
@AlexMamo yes the point is to go solo firebase ,no other db – Richardson Feb 19 '22 at 10:28
-
I'm sorry but I don't understand. What do you mean by "go solo firebase ,no other db"? – Alex Mamo Feb 19 '22 at 10:36
-
@AlexMamo I mean no backend for auth only fb – Richardson Feb 19 '22 at 10:38
-
I'm sorry but I have a hard time understanding what you need. Maybe @Dharmaraj can help. – Alex Mamo Feb 19 '22 at 10:38
-
1When using [Firebase auth](https://firebase.google.com/products/auth), you don't have to store anything in a database. Firebase stores credentials and things for you. You can however add user data in a database (Firebase has 2 databases - [Realtime DB](https://firebase.google.com/products/database) and [Firebase](https://firebase.google.com/products/firestore), which one are you using?). You can then use user's UID generated by Firebase auth to identify user's data in the database. Please edit your question and add details of what exactly you are trying to do. Screenshots would help. – Dharmaraj Feb 19 '22 at 10:59
-
1@Dharmaraj could you please make an answer.. this exactly what I wanted to know – Richardson Feb 19 '22 at 11:54
1 Answers
1
Firebase Authentication handles everything from hashing passwords to storing credentials and you don't have to store anything in a database. It also generates a unique UID for each user that can be used to identify user specific data in a database.
For example, if you have a collection "posts" then you can store the author's UID along with post data.
Also check: Firestore data modeling with more than one collection for each user

Dharmaraj
- 47,845
- 8
- 52
- 84
-
any idea how to access error object ? I am getting only a string no error object – Richardson Feb 19 '22 at 12:05
-
1@Richardson can you share any code? So it'll be clear how you are logging error right now. – Dharmaraj Feb 19 '22 at 12:07
-
1