Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Firebase Change Permissions Public Access SwiftUI

I am using Firebase for Auth and image storage–images that are publically available thoughout my app, like profile pictures. How do I set up the permissions appropriately so that any user (or even non-authenticated entities) can read these public images?

My security rules:

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

In your question, you say that you want non-authenticated entities to see the images, but your rules are set up to only allow authenticated entities to see them. You can change your rules to:

service firebase.storage {
    match /b/{bucket}/o {
        match /{allPaths=**} {
            allow read; 
            allow write: if request.auth != null;
        }
    }
 }
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading