• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Multiple users in Firebase

Q&A Forum › Multiple users in Firebase
0 Vote Up Vote Down
Guy Gauthier asked 3 years ago

In the data base, the JSON structure incluse the user ID and all the data. Like this example:

{
“UsersData” : {
“JXhbigMqPsOGEg9T99WXXXXXXXX” : { “outputs” : {
“digital” : {
“2” : 0,
“12” : 1
}, …

 

But If we were two or more users that want to access the exact same data base, where I should include the UUID of the other users ?

Thanks for your answer…

3 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Hi.
 
If you want to have multiple users accessing the database, you would need to structure it in a different way and then, add access via the database rules.
 
For example, for multiple users, I recommend removing the node with the user UID from the database structure because all users will be publishing on the same nodes.
 
Then, on the database rules, you specify that you only want to provide access to those users as follows:

{
  "rules": {
    ".read": ""auth.uid === 'REPLACE_WITH_YOUR_USER_UID' || auth.uid === 'REPLACE_WITH_USER_UID2'",
    ".write": "auth.uid === 'REPLACE_WITH_YOUR_USER_UID' || auth.uid === 'REPLACE_WITH_USER_UID2'"
  }
}

I hope this helps.
Regards,
Sara

0 Vote Up Vote Down
Guy Gauthier answered 3 years ago

Thank you very much for the answer…

0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

I’ll mark this issue as resolved.
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.