Firebase Storage: Setting Up Objects for Public Access

I have a small project using Firebase Storage service to serve some static files. By default, all files under a bucket are not accessible for public. To make files available for public access, we need to modify the rules.

In the following example, my bucket is called, since I need to give public permission to read, this is what I have in my storage rule.

rules_version = '2';
service {
  match /b/ {
    match /{allPaths=**} {
        allow read;
        allow write: if request.auth != null;

The above rule will keep the write access only for the authorised users.