Can wget / curl protect files from GCS?

Can wget / curl protect files from Google Cloud Storage without making them public? I am not against a fixed predefined token. I just want to avoid the case when my public file gets candy and I need good dollars.

+5
source share
3 answers

In another way, if, as you say, you do not mind to get the token from the outside, you need to use curl to set the "Authorization" header in your GCS call as follows:

curl -H "Authorization: Bearer 1/fFBGRNJru1FQd44AzqT3Zg" https://www.googleapis.com/storage/v1/b/bucket/o/object?alt=media 

The request parameter "alt = media" is required to directly download the object data instead of receiving a JSON response.

You can copy and paste the token obtained by authorizing with the Cloud Storage JSON API separately on the OAuth 2.0 Playground .

See also:
https://cloud.google.com/storage/docs/access-control https://cloud.google.com/storage/docs/json_api/v1/objects/get

+5
source

You can use Signed URLs . This allows you to create a signed URL that you can use to download the object without additional authentication.

+3
source

You can also use curlwget chrome extension , so whenever you upload something to Chrome, it creates a url with headers, etc., so that you can wget your file.

0
source

Source: https://habr.com/ru/post/1245461/


All Articles