I am trying to use pyrebase to download a file from firebase storage. This file is located in customers/BoomMZrVfrOOOYa4JVibOJQoroT2/example.txt, I'm using this code to download it:
This works when I allow read and write to anyone from firebase storage. I'm using these firebase storage rules:
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
match /customers/{userId}/{allPaths=**} {
allow read: if request.auth.uid == userId;
}
}
}
This only allows users to download files from a folder named with their user ID. The problem is that i cannot downloaded files from firebase storage if it requires authentication in my rules. If authentication is not required, then my code works.
@nosec2 , Pyrebase does not support what you're looking for. However firebase-rest-api available in PyPI, which I recently started maintaining, supports it.
I am trying to use pyrebase to download a file from firebase storage. This file is located in customers/BoomMZrVfrOOOYa4JVibOJQoroT2/example.txt, I'm using this code to download it:
UID = 'BoomMZrVfrOOOYa4JVibOJQoroT2' path_on_cloud = f"customers/{UID}/example.txt" storage.child(path_on_cloud).download("C:\Users\username\Desktop\test\k.txt")
This works when I allow read and write to anyone from firebase storage. I'm using these firebase storage rules:
rules_version = '2'; service firebase.storage { match /b/{bucket}/o { match /customers/{userId}/{allPaths=**} { allow read: if request.auth.uid == userId; } } }
This only allows users to download files from a folder named with their user ID. The problem is that i cannot downloaded files from firebase storage if it requires authentication in my rules. If authentication is not required, then my code works.