Firebase Storage Make only Selected Basket (Folder) Public



 One of the big issue I face with google cloud storage is when I go to build a site which has public as well as private sections.



Defult rule  as follows make the whole basket open to read which is not necessary.


 match /{allPaths=**} {
      allow read;
      allow write: if request.auth != null;
    }

If you make a basket (generated)  base rule and try to access the file without token like below , it will gives permission issue .


https://firebasestorage.googleapis.com/v0/b/<project id>.appspot.com/o/generated%test_400*400.png?alt=media&token=


{
  "error": {
    "code": 403,
    "message": "Permission denied. Could not perform this operation"
  }
}

The issue have to resolve in google cloud storate admin by giving access to perticular basket.

Ref : https://cloud.google.com/storage/docs/access-control/making-data-public#objects



Go to following URL :
https://console.cloud.google.com/storage/browser?project=<project-id>,

And grant Legacy viewer , Storgae viewer permission to all users.

Comments

Popular posts from this blog

Uplaod to Firebase Storage from Node Express REST

Firebase Cloud Functions TypeError: Cannot read property 'val' of undefined

Custom Email template for Laravel Password Reset