Pyrebase icon indicating copy to clipboard operation
Pyrebase copied to clipboard

Fixed get_url to return valid download link for service accounts. For multiple issues regarding 403 error.

Open kinguardo opened this issue 4 years ago • 1 comments

In case a service account was provided, call generate_signed_url endpoint instead of the default logic, to get a valid PUBLIC download link. By default, set the link expiration to 12 hours. For custom value, optional expiration parameter can be provided.

Fix for these issues regarding 403 error if service account being used was the cause of the issue: 218, 142, 100

Sample code used for testing:

import pyrebase

config = {} # set all the keys including "serviceAccount"

firebase = pyrebase.initialize_app(config)
storage = firebase.storage()
file = storage.child("cat.jpg") # set the correct path
print(file.get_url())

Output: check

kinguardo avatar Feb 02 '22 15:02 kinguardo

Hi there, I've initiated a project to maintain this library, and I'll be using your solution to fix the mentioned bug. I'll co-author you in the commit of the fix, as I've modified it a bit. Feel free to reach me using my email displayed in my profile.

Repo: firebase-rest-api available in PyPI

best regards

AsifArmanRahman avatar Jul 22 '22 11:07 AsifArmanRahman