I am trying to update my firebase rules and for some reason I am being hit with this warning. I have looked into json validators but no luck
Error saving rules - Line 6: Expected '}'.
{
"rules": {
".read": "auth.uid != null",
".write": "auth.uid != null"
},
"users": {
"$uid": {
".read": "auth.uid != null",
".write": "auth != null && auth.uid == $uid"
}
},
"usersWipes" : {
"$uid": {
".read": "auth.uid != null",
".write": "auth != null && auth.uid == $uid"
}
},
"user-messages": {
"$uid": {
".read": "auth.uid != null",
".write": "auth != null && auth.uid == $uid"
}
},
"stripe_customers": {
"$uid": {
".read": "auth != null && auth.uid == $uid",
".write": "auth != null && auth.uid == $uid"
}
},
"notifications": {
"$uid": {
".read": "auth != null",
".write": "auth != null && auth.uid == $uid"
}
},
"messages": {
"$uid": {
".read": "auth != null",
".write": "auth != null && auth.uid == $uid"
}
},
"jobPost": {
"$uid": {
".read": "auth != null",
".write": "auth != null"
}
},
"reportedJobs": {
"$uid": {
".read": "auth != null && auth.uid == $uid",
".write": "auth != null"
}
},
"deletedAccounts": {
"$uid": {
".write": "auth != null && auth.uid == $uid"
}
}
}
I have tried using google gemini and chat as well as reaching google directly but no luck. What's going wrong here?
The rules for each of the parent nodes you want to protect (users, usersWipes, etc) need to be nested under the rules
block in your JSON. Right now, they are sibling to rules
, which is not correct. See the examples in the documentation.
{
"rules": {
".read": "auth.uid != null",
".write": "auth.uid != null",
// these need to be nested under "rules"
"users": {
"$uid": {
".read": "auth.uid != null",
".write": "auth != null && auth.uid == $uid"
}
},
"usersWipes" : {
"$uid": {
".read": "auth.uid != null",
".write": "auth != null && auth.uid == $uid"
}
},
// the rest of your rules follow
}
},