I have set up the following security rule, because I only want Admins to be able to write to the collection enums:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /enums/{test}/ {
allow read;
allow write: if request.auth.token.admin == true;
}
When I am trying to write from the client I get the following error:
Uncaught (in promise) FirebaseError: PERMISSION_DENIED: No matching allow statements
although the request.auth.token.admin
is set to true, as you can see in the following image:
I don't want to modify this: allow write: if true;
because I am trying to develop some production ready rules.
Do you have an idea what I am doing wrong here?
I made the greatest mistake of all time here guys... a typo.
My collection should be called enum
instead of enums
. It took me several days to find this out.
PS: Firebase is amazing :-)