Posts

Showing posts from October, 2018

Firebase Storage - File upload to folder 403 Firebase Storage: User does not have permission to access

Image
When I was using firebase storage from the client side without admin sdk , I got the following error with the authenticated user, when I am uploading an image.   var temp = storage.ref().child("temp")                          .child(file.name);     temp.put(file)     .then(snap => { .... } Firebase Response  : Firebase Response  : FirebaseStorageError {code_: "storage/unauthorized", message_: "Firebase Storage: User does not have permission to access 'temp/50.png'.", serverResponse_: "{ ↵   "error": { ↵     "code": 403, ↵     "message": "Pe…n denied. Could not perform this operation" ↵   } ↵ }", name_: "FirebaseError"} The error is due to the issue in firebase storage rules. The document pages do not specify how to set permission to all the objects under the given folder . However , they have given an example...

Google Storage set file permission when Save File or Write Stream

Image
The brackets in the Google cloud storage or Firebase storage have a permission set which is common to all files. However, we should have the capability to set the permission to each file as we need. Although I have discussed early in the post  Make Storage Public , the custom permission can correctly assign using  ALC. Refer the Doc:https://cloud.google.com/nodejs/docs/reference/storage/1.3.x/Acl#add If you are using a storage file you can access the file and do the modification.    const file = firebase.storage().bucket().file('originals/file.png');                                    const options = {                                     entity: 'allUsers',                             ...