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
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
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.
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
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