0

Does anyone know how to combine oauth done with scribe with Gdata Service:

So after authenticating with scribe I have access token and need to push it to instance of gdata ContactsService (for any other service it would work the same, i guess).

I've tried simple

GoogleCredential credential = new GoogleCredential();
credential.setAccessToken(accessTokenString);

where accessTokenString is a String achieved from scribe after running

Token accessToken = service.getAccessToken(requestToken, verifier);

but that didn't work with exception on doing request:

Exception in thread "main" java.lang.NullPointerException: No authentication header information
at com.google.gdata.util.AuthenticationException.initFromAuthHeader(AuthenticationException.java:96)
at com.google.gdata.util.AuthenticationException.<init>(AuthenticationException.java:67)
at com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:608)
at com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:564)
at com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:560)
at com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:538)
at com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:536)
at com.google.gdata.client.Service.getFeed(Service.java:1135)
at com.google.gdata.client.Service.getFeed(Service.java:998)
at com.google.gdata.client.GoogleService.getFeed(GoogleService.java:645)
at com.google.gdata.client.Service.getFeed(Service.java:1017)

It would be nice to combine scribe with gdata, as I have scribe ready, and gdata offers a better api to handle data from google

Thanks

Tomasz Bartczak
  • 597
  • 5
  • 6

1 Answers1

0

I don't know what accessTokenString is on your example. I assume it's the result of calling the toString method on a Scribes accessToken object.

If that's so and gdata is expecting just the access token, you should do:

Token accessToken = service.getAccessToken(requestToken, verifier);
GoogleCredential credential = new GoogleCredential();
credential.setAccessToken(accessToken.getToken());
Pablo Fernandez
  • 103,170
  • 56
  • 192
  • 232