I am trying to only allow reads coins's documents if the user's uid matches the userId (encircled in red).
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if false;
}
match /coins/{coinId} {
allow read: if request.auth != null && resource.data.userId == request.auth.uid;
allow write: if request.auth != null;
}
}
}
This rule returns an error in the console when I log into my account. And no data is displayed.
Uncaught error in snapshot listener: FirebaseError: Missing or insufficient permissions.
Based on everything I've read here it seems like the following code should work, but it doesn't.