com.google.api.ads.common.lib.exception.OAuthException: Credential could not be
refreshed.
at com.google.api.ads.common.lib.auth.OfflineCredentials.generateCredent
ial(OfflineCredentials.java:178)
at Processor$DownloadReport.report(DownloadReport.java:48)
at Processor.processRow(Processor.java:242)
at org.pentaho.di.trans.steps.userdefinedjavaclass.UserDefinedJavaClass.
processRow(UserDefinedJavaClass.java:1181)
at org.pentaho.di.trans.step.RunThread.run(RunThread.java:50)
at java.lang.Thread.run(Unknown Source)
Caused by: com.google.api.client.auth.oauth2.TokenResponseException: 400 Bad Req
uest
{
"error" : "invalid_grant"
}
at com.google.api.client.auth.oauth2.TokenResponseException.from(TokenRe
sponseException.java:105)
at com.google.api.client.auth.oauth2.TokenRequest.executeUnparsed(TokenR
equest.java:287)
at com.google.api.client.auth.oauth2.TokenRequest.execute(TokenRequest.j
ava:307)
at com.google.api.client.auth.oauth2.Credential.executeRefreshToken(Cred
ential.java:570)
at com.google.api.client.googleapis.auth.oauth2.GoogleCredential.execute
RefreshToken(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(OAut
h2Helper.java:69)
at com.google.api.ads.common.lib.auth.OfflineCredentials.generateCredent
ial(OfflineCredentials.java:172)
... 5 more
GoogleAuthorizationCodeFlow authorizationFlow = new GoogleAuthorizationCodeFlow.Builder(new NetHttpTransport(), new JacksonFactory(), clientSecrets, Lists.newArrayList(SCOPE)).setAccessType("offline").build();
3. Get the 'Authorization URL' GoogleAuthorizationCodeTokenRequest tokenRequest = authorizationFlow.newTokenRequest(authorizationCode);
tokenRequest.setRedirectUri(CALLBACK_URL);
GoogleTokenResponse tokenResponse = tokenRequest.execute();
6. Create the OAuth2 credential and set the token responseGoogleCredential credential = new GoogleCredential.Builder().setTransport(new NetHttpTransport()).setJsonFactory(new JacksonFactory()).setClientSecrets(clientSecrets).build();
credential.setFromTokenResponse(tokenResponse);
7. Get the refresh token from the GoogleCredential object
8. Use that refresh token in the application
Hope this is what you were looking for.. .
Thanks,
Ramz