0
votes

I'm developing an application with Google App Engine. I need to read PDF files from my Google Cloud Storage. Here the code:

String filename = "...";
BlobstoreService blobstore = BlobstoreServiceFactory.getBlobstoreService();
BlobKey blobkey = blobstore.createGsBlobKey(filename);
blobstore.serve(blobkey, httpResponse);

It works only if I set "Share Publicly" on the file in my bucket. How can I read the file without setting "Share Publicly"?

1

1 Answers

1
votes

You need to add your app's service account to the bucket acls. See Section 5 of the Google Cloud Storage Prerequisites.