What is the best way to implement Google Cloud Storage?

I use Google Cloud Storage for server-side content such as user videos, images, and profile pictures. I have some doubts about what is the best practice for implementing the Google concept for Google Signed URLs.

As for me

1st: - I can save the name of the object in the database and create a signed URL to receive this content every time. But there is an additional API call from the client side.

2nd: - I can generate a signed URL during the loading of the content and save it in the database with a long term. Thus, there are no additional API calls on the client side.

But what about the expiration of the URL. Please suggest me the best approach to its implementation.

+5
source share
2 answers

Signed URLs rely on expiration to provide security , so setting a very high expiration time and keeping the signed URL indefinitely can compromise this.

A good compromise is to cache the signed URL somewhere (for example, in the database) and only re-create it after it expires, and not every time the client requests it.

+1
source

You do not need an API call to create a signed URL, you can get a JSON key and create a URL with common ssl tools from many programming languages; look at the documentation with the signature of the URL , it is much easier and safer to generate them on the fly.

Just found this other answer that might help.

0
source

All Articles