I have a collection called users in my firebase setup. I have the following rule setup (to allow anyone to read and write):
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
allow read, write: if true;
}
}
Now when I try access the data in the collection using the following:
const usersRef = db.ref("users");
usersRef.on("value", snapshot => {
const users = snapshot.val();
console.log(users);
this.setState(() => ({ loading: false, users }));
}, function(error) {
console.error('error', error);
});
I get the following permission issue:
error Error: permission_denied at /users: Client doesn't have permission to access the desired data.
How come?