Having a little problem with a Firebase Rule.
Here is my rule:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /question/{questionId}{
allow read : if (request.auth.token.email_verified == true) &&
(request.auth.uid == resource.data.quid);
}
}
}
This fails with:
FirebaseError: [code=permission-denied]: Missing or insufficient permissions
However, when changing (request.auth.uid == resource.data.quid); to (request.auth.uid == 'gTEsGw3cUlaCswmVwpgdSzEd1TW2'); it works fine. I can also match against email address just fine. Just not the uid to quid field.
Thoughts?
If it matters, this is the query in my code:
const showQuestions = () => {db.collection('question').where("email", "==", userObject.email).onSnapshot( data => {
questions = data.docs;
})
}
