NPE in OAUTH

43 views
Skip to first unread message

Gopi

unread,
Oct 28, 2014, 6:37:43 PM10/28/14
to adwor...@googlegroups.com

While migrating to 201409, i am seeing the below exception with OAUTH. I verified the client ID and client secret, they are passed correctly. Is there any thing else i need to verify for this.

Using the Refresh token generatedby GetRefreshToken sample code.

Credential credential = new OfflineCredentials.Builder()
              .forApi(OfflineCredentials.Api.ADWORDS)
              .withClientSecrets(clientId, clientSecret)
              .withRefreshToken(refreshToken)
              .build()
              .generateCredential();

java.lang.NullPointerException
        at com.google.api.client.repackaged.com.google.common.base.Preconditions.checkNotNull(Preconditions.java:191)
        at com.google.api.client.util.Preconditions.checkNotNull(Preconditions.java:127)
        at com.google.api.client.json.jackson2.JacksonFactory.createJsonParser(JacksonFactory.java:92)
        at com.google.api.client.json.JsonObjectParser.parseAndClose(JsonObjectParser.java:85)
        at com.google.api.client.json.JsonObjectParser.parseAndClose(JsonObjectParser.java:81)
        at com.google.api.client.auth.oauth2.TokenResponseException.from(TokenResponseException.java:88)
        at com.google.api.client.auth.oauth2.TokenRequest.executeUnparsed(TokenRequest.java:287)
        at com.google.api.client.auth.oauth2.TokenRequest.execute(TokenRequest.java:307)
        at com.google.api.client.auth.oauth2.Credential.executeRefreshToken(Credential.java:570)
        at com.google.api.client.googleapis.auth.oauth2.GoogleCredential.executeRefreshToken(GoogleCredential.java:362)
        at com.google.api.client.auth.oauth2.Credential.refreshToken(Credential.java:489)
        at com.google.api.ads.common.lib.auth.OAuth2Helper.callRefreshToken(OAuth2Helper.java:70)
        at com.google.api.ads.common.lib.auth.OfflineCredentials.generateCredential(OfflineCredentials.java:144)

Thanks
Gopi

Josh Radcliff (AdWords API Team)

unread,
Oct 30, 2014, 8:34:12 AM10/30/14
to adwor...@googlegroups.com
Hi Gopi,

Are you using the latest version of the Java client library and its dependencies? Specifically, there is a new version of the OAuth library that fixes this NPE -- see issue 19.

Cheers,
Josh, AdWords API Team
Reply all
Reply to author
Forward
0 new messages