0

I want to upload audio files to firebase storage using gcs_upload function in googleCloudStorageR R package. These files need to be accessed by everybody authenticated through firebase authentication.

If I go to Firebase Storage Console and upload the files manually, it automatically creates an access token and generate a link to access the file, under the file name (see image below).

When I upload through googleCloudStorageR, it does not generate the access token, neither the link to access the file.

  1. How to upload it (not manually) in a way that anyone authenticated may access it?
  2. How to change (through an API other than the console) the access control for the uploaded files? enter image description here
Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
Alan Alves
  • 61
  • 1
  • 2
  • 9

1 Answers1

1

Only the Firebase client-side SDKs, and the Firebase console, provide the option to generate so-called download URLs. This option does not exist in most server-side SDKs, or the REST APIs.

Your two alternatives are to either generate a long-lived signed URL for your upload (which most server-side SDKs do support), or to explicitly set an access token in the metadata of the file as shown here: https://stackoverflow.com/a/43764656. The code sample there is for Node.js, but the approach works across all SDKs that allow you to set custom metadata.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807