DavidVdd
DavidVdd

Reputation: 1018

GoogleDrive api quickstart configuration Authorisation

I'm trying to use the google drive api to get files from my drive but I can't seem to get this quickstart working.

https://developers.google.com/drive/quickstart

I'm using the java sample. When I try this I get 3 errors.

 String url = flow.newAuthorizationUrl().setRedirectUri(REDIRECT_URI).build();

Build(); //doesn't exist

 GoogleCredential credential = new GoogleCredential().setFromTokenResponse(response);

Required tokenresponse found googletokenresponse

 Drive service = new Drive.Builder(httpTransport, jsonFactory, credential).build();

No suitable constructor found for (HttpTransport, JsonFactory, GoogleCredential).

I used the jars that I downloaded on the sample page.

How can I authenticate users so I can use the Drive service?

Is there another quickstart wich works properly?

Upvotes: 1

Views: 352

Answers (1)

Alain
Alain

Reputation: 6034

You are probably missing the core client library dependencies that can be downloaded from here. We will update the quickstart guide to mention it.

Once you have downloaded the required dependencies, in addition to the Drive API .jar, you will need to add those additional dependencies to your project:

google-api-client-1.10.3-beta.jar
google-oauth-client-1.10.3-beta.jar
google-http-client-1.10.3-beta.jar
commons-logging-1.1.1.jar
gson-2.1.jar
guava-11.0.1.jar
httpclient-4.0.3.jar
httpcore-4.0.1.jar
jackson-core-asl-1.9.4.jar
jsr305-1.3.9.jar
protobuf-java-2.2.0.jar
xpp3-1.1.4c.jar

The quickstart sample depends on the google-api-java-client version 1.10.3-beta, make sure to download this version.

Upvotes: 1

Related Questions