Reputation: 55
Im trying to set some storage rules for make only the UID users I specify can access to all paths of my storage.
Im tried this:
service firebase.storage {
match /b/{bucket}/o {
match /user/{userId}/{allPaths=**} {
allow read, write: if request.auth.uid == userId;
}
}
}
with that rules setted up , I cant access to my storage, Im trying with "rules testing area".
My question is, how to add the specifics UserId I want to grant access to my storage?.
Upvotes: 1
Views: 478
Reputation: 55
Thanks People, I resolved my problem. I created a group and specify whats Uid what to have access. this is my solution for now:
rules_version = '2';
function usersPermitidos() {
return request.auth !=null && request.auth.uid in [
"uiduser",
"uiduser"
];
}
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read: if usersPermitidos();
}
}
}
I take the solution from here: Create group access to firebase storage without using custom authorization
Upvotes: 2