• 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

Firebase Web App Project

Q&A Forum › Category: ESP8266 › Firebase Web App Project
0 Vote Up Vote Down
CHARLES SANTINI asked 1 year ago

I would to like to allow reading access to my BME280 data base. I’ve declare a second user with mail/password and I got a new specific uid. I’m able to login the web app but no readings displayed.
i guess the current Security Rules are not relevant to achieve it .
“rules”: {
“UsersData”: {
“$uid”: {
“.read”: “$uid === auth.uid”,
“.write”: “$uid === auth.uid”
}}}
any advice? thanks

5 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 1 year ago

Hi.
Those rules allow access to the database to the nodes under the user UID in the database.
If the device is publishing under a node with its own UID, only that device can access that data with these rules.
 
To provide access to the database to users regardless of the data, you can use something as follows (replace the UID with the UIDS of the users you want to provide access).
 
{
  “rules”: {
    “.read”: “auth.uid === ‘SPECIFIC_UID_1‘ || auth.uid === ‘SPECIFIC_UID_2‘”,
    “.write”: “auth.uid === ‘SPECIFIC_UID_1‘ || auth.uid === ‘SPECIFIC_UID_2‘”,
  }
}
 
I hope this helps. Let me know if this works for you.
Regards,
Sara

0 Vote Up Vote Down
CHARLES SANTINI answered 1 year ago

hi Sara,
thank you for your quick answer.
i’ve modified SECURITY RULES according to what you proposed , but unfortunatly no improvement.
Datas are still only reachable by the UID publishing data.
 

0 Vote Up Vote Down
Sara Santos Staff answered 1 year ago

Hi.
I’m sorry for the delay in my response. For some reason, I didn’t receive a notification of your answer.
We can try other database rules that allow access to the entire database to logged-in users:

{
    "rules": {
        ".read": "auth != null",
        ".write": "auth != null"
    }
}

 
 
Let me know if this helps.
 
Regards,
Sara

0 Vote Up Vote Down
CHARLES SANTINI answered 1 year ago

Hello sara, thank you again tfor your answer.
now it works!! I guess i had since the begining an issue with the user email, despite it is valid.
but changing it and using the rules you proposed the pb is fixed.
pratically i made a mixed of your two proposal : writing allowed only to specific user.
KR
Charles

0 Vote Up Vote Down
Sara Santos Staff answered 1 year ago

Great.
I’ll mark this issue as resolved. If you need further help, you just need to open a new question in our forum.
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

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition 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.