1
votes

I have a scenario where a user can upload images to Firebase Storage, however I do not want them to be able to get a URL for these images (Copy Image Address). Instead I want to provide them with a blob.

When a user uploads the image client side, I get the download URL and store that in Firestore. When the user wants to see the image, I have a cloud function that downloads that image, and sends it to the user as a blob.

This works great for images the user uploads, however I also have a cloud function that is triggered automatically when an image is uploaded and generates a thumbnail.

How do I go about getting a permanent download URL from a Cloud Function/Node server for this generated image? I can get a signed one, but it's not what I need

2
What's wrong with a signed URL? What exactly do you need this URL to do that's not covered by a signed URL?Doug Stevenson

2 Answers

1
votes

You can't directly with Google Cloud Storage. The signed URL can't live more than 7 days

The longest expiration value is 604800 seconds (7days).

You can keep the link of the generated thumbnail image, but you have to either download it and serve it each time, or generate a signed url for using and displaying it, each time also. This second solution reduces the processing time and thus the cost.

0
votes

If you want a permanent URL to access your data, you could make them public according to this documentation[1].

Just keep in mind that when accessing public data through the Google Cloud Platform Console, you must authenticate with Google. It can be accessed with any Google account, the account does not have to be associated with the project that contains the public data, nor must it be registered in the Cloud Storage service [2].

[1] https://cloud.google.com/storage/docs/access-control/making-data-public

[2] https://cloud.google.com/storage/docs/access-public-data