0
votes

From a Google cloud application, I need to open a file located in my project’s cloud storage. I tried to use a URL of the following form to access the file but I get the error below: http://storage.googleapis.com/my-bucket/my-file Error: Access denied. Anonymous caller does not have storage objects

www.googleapis.com/upload/storage/v1/b/http://my_appl//my-bucket/my-file Error 404 www.googleapis.com/storage/v1/b/my-bucket/my-file Error 404

https://www.googleapis.com/storage/v1/b/my-bucket/o/my-file "code": 401, "message": "Anonymous caller does not have storage.objects.get access to my-bucket/my-file

https://www.googleapis.com/storage/v1/b/my-bucket/o/my-file/place?key=my-key Not found

Am I composing the URL incorrectly?

1

1 Answers

1
votes
http://storage.googleapis.com/my-bucket/my-file 

This one is fine. However, unless an object is publicly readable, you'll need to authorize the request, which means either including an "Authorization" header in the request with appropriate credentials or signing the URL with the private key of a service account.

https://www.googleapis.com/download/storage/v1/b/my-bucket/o/my-file?key=my-key&alt=media

This is also okay, but an API key does not provide authentication. You'll still need an Authorization header unless the object is publicly viewable.