Invalid grant - cannot access api

2017-06-27 Thread LKRPL
Hi,
we have the following error: 

Exception in thread "main" 
com.google.api.ads.common.lib.exception.OAuthException: Credential could 
not be refreshed.
at 
com.google.api.ads.common.lib.auth.OfflineCredentials.generateCredential(OfflineCredentials.java:178)
at it.reply.fcadda.ForecastGenerator.GetCampaigns.main(GetCampaigns.java:46)
Caused by: com.google.api.client.auth.oauth2.TokenResponseException: 400 
Bad Request
{
  "error" : "invalid_grant"
}
at 
com.google.api.client.auth.oauth2.TokenResponseException.from(TokenResponseException.java:105)
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:69)
at 
com.google.api.ads.common.lib.auth.OfflineCredentials.generateCredential(OfflineCredentials.java:172)

-The code here: 
"https://developers.google.com/adwords/api/docs/samples/java/optimization#estimate-keyword-traffic";
-Ads.properties details: 
a) clientId and clientSecret (associated to this account) 
b) clientCustomerId: account created by a test account
c) developerToken (associated to this account)
d) refreshToken (obtained following 
this:"https://github.com/googleads/googleads-java-lib/wiki/API-access-using-own-credentials-(installed-application-flow)#step-2---setting-up-the-client-library"
 
through the test account).

Can you help us? Thanks.

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/3b8c0b8d-4fe3-417d-a631-4ad8225cf69d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Invalid grant - cannot access api

2017-06-27 Thread 'Peter Oliquino' via AdWords API Forum
Hi,

The "invalid_grant" error usually indicates that the access or refresh 
token being passed in your request is incorrect or invalid. Before 
proceeding further, could you first confirm if you are indeed using a test 
account 

 to 
estimate keyword traffic? If yes, could you also confirm if you created the 
OAuth2 
credentials 
 while 
logged in to the email address associated to your test MCC account? If not, 
please 
do so and generate a new refresh token then retry your request. Let me know 
if the issue persists.

Thanks and regards,
Peter
AdWords API Team

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/0f993d58-7c85-4388-8d2f-8ca2d5095115%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.