fer626 / google-api-java-client

Automatically exported from code.google.com/p/google-api-java-client
0 stars 0 forks source link

Code example for "Installed Applications" is wrong on OAuth2Native.java #492

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I'm using Java 6 and my google-api-java-client is 1.8.0-beta. The code example 
for installed applications described on the class OAuth2Native.java is 
partially wrong, I suppose. I'm doing some requests for the Google Calendar API 
and I noted the credentialStore attribute from the AuthorizationCodeFlow was 
null. Then, when doing multiple requests, it isn't possible to know if the user 
credentials are set or not.

The current code example is:

GoogleAuthorizationCodeFlow flow = new 
GoogleAuthorizationCodeFlow.Builder(transport, jsonFactory, clientSecrets, 
scopes).build();

But I think it should be:

GoogleAuthorizationCodeFlow flow = new 
GoogleAuthorizationCodeFlow.Builder(JACKSON_FACTORY, CLIENTS_SECRETS, 
SCOPES).new MemoryCredentialStore()).build();

The last one sets the MemoryCredentialStore on the Builder instance, but it 
could be other credential store strategies, as stated in OAuth2 page.

Original issue reported on code.google.com by rafael.n...@gmail.com on 19 May 2012 at 2:16

GoogleCodeExporter commented 9 years ago

Original comment by rmis...@google.com on 14 Jan 2013 at 3:32

GoogleCodeExporter commented 9 years ago
https://code.google.com/p/google-api-java-client/wiki/OAuth2

Original comment by yan...@google.com on 14 Jan 2013 at 5:41