Lalit Rane
Lalit Rane

Reputation: 890

Google App Engine - GoogleCredential.getApplicationDefault(transport, jsonFactory) Not Found

I need to use Google Cloud Storage from Google App Engine. So for this, I am trying to use Application Default Credentials to get authorization credentials to connect to Cloud Storage API. I added the Google Cloud Storage JSON API in eclipse using add Google Api option. It added google-api-client-1.18.0-rc.jar. This jar does not have below method.

GoogleCredential credential = GoogleCredential.getApplicationDefault(transport, jsonFactory);

When I see the Samples I see below dependency

<dependency>
      <groupId>com.google.apis</groupId>
      <artifactId>google-api-services-storagetransfer</artifactId>
      <version>v1-rev1-1.20.0</version>
    </dependency>

But in eclipse, while using add Google API window, I do not see a way to find this "v1-rev1-1.20.0" version of Google Cloud Storage API. How can I download the Google Cloud Storage API jars which are compatible to version v1-rev1-1.20.0?

Upvotes: 0

Views: 362

Answers (1)

Andrei Volgin
Andrei Volgin

Reputation: 41089

Since you are accessing Cloud Storage from App Engine, you can use GCS client built for App Engine:

GcsService gcsService = GcsServiceFactory.createGcsService();
// ...
ListResult objects = fileService.list(MY_BUCKET_NAME, ListOptions.DEFAULT);
// ... and so on

Upvotes: 1

Related Questions