Skip to content

Storage Rules and Custom Tokens #219

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
blaforet opened this issue May 2, 2018 · 1 comment
Closed

Storage Rules and Custom Tokens #219

blaforet opened this issue May 2, 2018 · 1 comment

Comments

@blaforet
Copy link

blaforet commented May 2, 2018

Hi
I'm able to upload the files to firebase storage, I then store the data information in firestore document.
But i have difficulty with the Storage Rules. No matter what rules i put, the url given by snapshot.downloadURL make the document accessible from any computer/device, logged in or not, no matter what.

Rules:
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write: if request.auth.uid == 'blabla';
}
match /users/{userId} {
allow read, write: if request.auth.token.premiumAccount == true;
}
}}

URL Example

Look like the token provided by the snapshot.downloadURL surpass all storage rules.

Custom Token
I've created the a cloud function that generate a Custom Token and when i change that token for my new custom token, i get an error 403, permission denied.

I must do something wrong.
Any suggestion?

Thank you

@jhuleatt
Copy link
Contributor

jhuleatt commented Aug 8, 2019

This issue in the JS SDK has lots of discussion on this topic, as well as some suggested workarounds.

@jhuleatt jhuleatt closed this as completed Aug 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants