Question

We have an application using Google Contacts with 2-legged OAuth 1.0 which works great but we want to migrate to OAuth 2.0. So far it looks like old GData libraries aren't playing nice with this OAuth 2.0 and 2-legged authorization. On the other hand new google-api-client libraries handles this gracefully but it doesn't provide Contacts API. So we wanted to use the new GoogleCredentials which are really simple to use with the old ContactsService but it the Bearer token is set to null in the request causing java.lang.NullPointerException: No authentication header information. Does anybody have an idea what may go wrong?

Anonymized test script can be found at https://gist.github.com/musketyr/9394815

Was it helpful?

Solution

The NPE is due to a bug that only affects certain user agents. You can work around it using the method I described here: Google Contacts API - failing to refresh access token. Fixing that should allow you to get more information about the error being thrown.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top