'How to set a match path in security rules
I am trying to learn how to use security rules but it is not working
I actually wrote two rules
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read: if request.auth != null;
}
match /users/{user} {
allow create: if request.auth != null;
}
}
}
First one is working perfectly but the second one is not although I have a collection called users
Solution 1:[1]
You're trying to write to the path documents/users in the database, which creates a document called users in the documents collection. Your security rules only allow writing to the users collection, so more like you'll want to write to users/myuid in the playground.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Frank van Puffelen |
