Giacomo Savioli
Giacomo Savioli

Reputation: 177

Read files from Google Cloud Storage on App Engine

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"?

Upvotes: 0

Views: 700

Answers (1)

Sebastian Kreft
Sebastian Kreft

Reputation: 8199

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

Upvotes: 1

Related Questions