I have rules on Firebase Realtime Database as follows:
{
"rules": {
".read": "auth.uid !== null",
".write": false,
"Prodotti per autocomplete":{
".indexOn": "Marca"
}
}
}
My intention is that it reads only those who are authenticated and it works, but mails arrive every day from Firebase telling me that the security rules are not set at their best and they suggest me to set the read like this:
".read": "auth != null && $uid === auth.uid"
The problem is that it doesn't recognize the variable $uid
. Since I can't figure out how to manage this variable (for any big gaps I have), maybe some of you have some suggestions.
The data in the database is products and prices of products that I want to appear for all logged in users. It is not personal information. Should I store all the uids in the database so that when $uid is invoked it doesn't give an error? What is the "$" sign used for in this case?