Search code examples
oauth-2.0gdata-apipicasa

OAuth2 + GData Client API - usage


I am trying build a page, where a user can login using his google id and can access Picasaweb albums.

I am using gdata-java-client-1.47.1.zip (downloaded from here), google-oauth-java-client-1.10.1-beta.zip (downloaded from here) and google-api-java-client-1.10.3-beta.zip (downloaded from here)

After setting up the OAuth2 workflow and getting the access token, I had created Credential object

return new GoogleCredential.Builder().setClientSecrets(CLIENT_ID, CLIENT_SECRET)
          .setJsonFactory(jsonFactory).setTransport(transport).build().setAccessToken(gtresponse.getAccessToken()).setRefreshToken(gtresponse.getRefreshToken());

When I am trying to create the PicasawebService object and set OAuth2Credentials as mentioned in this link, I do NOT see a method setOAuth2Credentials in the list of methods available for PicasawebService object. I can only see setOAuthCredentials(parameters, signer) method available. Is this expected?

Not sure where I should go from here on how to access the web albums data? Kind of stuck! please help?

Thank you,

Satya


Solution

  • Try using PicasaClient as is done in this sample:

    PicasaClient client = new PicasaClient(HTTP_TRANSPORT.createRequestFactory(credential));
    

    You probably have to include PicasaClient, PicasaUrl and the model classes manually.

    Another option would be to go down the already deprecated, but supported until April 2015, AuthSub way.