Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making firebase storage public for reading and writing on android

I am new to firebase storage. Can anyone tell me how to make the storage files public for reading and writing?. The default code provided by firebase is given below. What changes should I make ?

service firebase.storage {   match /b/image-view-b1cf5.appspot.com/o {     match /{allPaths=**} {       allow read, write: if request.auth != null;     }   } } 
like image 896
ashay Avatar asked Jul 29 '16 15:07

ashay


People also ask

How do I read Firebase Storage?

Accessing Files Through References Although Firebase Storage uses a real-time database you can access data via a familiar file/folder system. When accessing files, you simply need to call the reference where your file is stored. References also enable you to control where files are stored and how files are labeled.

How do I change Storage rules in Firebase?

You can edit these rules by selecting a Firebase app in the Firebase console and viewing the Rules tab of the Storage section.


2 Answers

FYI: if you want public read only.

service firebase.storage {   match /b/image-view-b1cf5.appspot.com/o {     match /{allPaths=**} {         allow read;         allow write: if request.auth != null;     }   } }  
like image 154
Ego Slayer Avatar answered Sep 28 '22 02:09

Ego Slayer


The documentation explains that if no rule expression is provided, the rule evaluates to true:

service firebase.storage {   match /b/image-view-b1cf5.appspot.com/o {     match /{allPaths=**} {       // Allow access by all users       allow read, write;     }   } } 
like image 34
Bob Snyder Avatar answered Sep 28 '22 01:09

Bob Snyder