For some reason I can not get wildcards to work in a path with custom tokens.
The user has the custom tokens assigned like admin: true
and ySWLb8NSTj9sur6n2CbS: true
service firebase.storage {
match /b/{bucket}/o {
match /conferences/{confId}/sponsors/{sponsId=**} {
allow read: if request.auth.uid != null
allow write: if request.auth.token.confId == true
}
}
}
I am trying to write to /conferences/ySWLb8NSTj9sur6n2CbS/sponsors/whatever.jpeg from the client and got an access denied.
If I change now to the below it works without problems.
service firebase.storage {
match /b/{bucket}/o {
match /conferences/{confId}/sponsors/{sponsId=**} {
allow read: if request.auth.uid != null
allow write: if request.auth.token.admin == true
}
}
}
I have even tested it with changing the custom token to ySWLb8NSTj9sur6n2CbS: "ySWLb8NSTj9sur6n2CbS"
and then trying the below without success and getting access denied!
service firebase.storage {
match /b/{bucket}/o {
match /conferences/{confId}/sponsors/{sponsId=**} {
allow read: if request.auth.uid != null
allow write: if request.auth.token.confId == confId
}
}
}
I have the feeling the wildcard is not picked up for some reason or am I overlooking something here? On the documentation I found this: https://firebase.google.com/docs/storage/security/user-security?authuser=0