I am using custom claims to grant access to firestore. I have it set already on the user, like so.
admin.auth().setCustomUserClaims(
userId, {[myId123]:true})
Now I'm trying to write a rule to allow access. Here's what I have written.
match /myCollection/{myDocId} {
allow read, write: request.auth.token.myDocId;
}
The docId I'm trying to access is myId123
, but it is giving me permission denied when I try to access it.
So I manually wrote the rule like so...
match /myCollection/{myDocId} {
allow read, write: request.auth.token.myId123;
}
... and now I have access. Since this works, I'm thinking that it's not interpreting myDocId
to be a variable, but shouldn't myDocId
be interpreted as a string there? What am I missing. Why isn't this working.
Instead of...
... you specify the id like ...