Firebase: Permission Denied - Setvalue()
Solution 1:
Try changing your rules to the following and it'll work.
{"rules":{".read":true,".write":true}}
As per Frank van Puffelen's comment your rules require the user is not authenticated.
You can read more about the authentication rules here for other options if you need more secure authentication
Hope this helps you
Solution 2:
Firstly your user must be authenticated as Firebase provide lots of platforms to make user authenticated with it. Example - Google, Facebook, Twitter etc. As user got authenticate by firebase console he/she get access to relevant database and storage. You can also make a user as a guest by using Firebase anonymous authentication.
By doing authentication every user gets a UID using which you can use to give access to them by writing rules if you want different rules for different users.
{
"rules": {
"users": {
"$uid": {
".read": "$uid === auth.uid",
".write": "$uid === auth.uid"
}
}
}
}
By default you will get something like this in your database rules section :-
{"rules":{".read":"auth != null",".write":"auth != null"}}
This simply means that if the user authenticated then only give them read and write access. Apply to all users.
By doing something like this, you are making your database accessible to everyone and also those people who are not using your product.
{"rules":{".read":true,".write":true}}
You can do this for testing purpose of your product, but this is not a secure way.
Post a Comment for "Firebase: Permission Denied - Setvalue()"