Hello Magnus,

Do you re-use the obtained access token? It is valid for one hour and 
should be re-used. This kind of error is likely if you only keep the 
refresh token and obtain a new access token for each request.


-Danial, AdWords API Team.


On Thursday, January 23, 2014 11:35:03 AM UTC+4, Magnus Ljung wrote:
>
> Hi,
>
> We are using the Java client libraries to access the AdWords API. Lately 
> we have started to get this kind of errors:
>
> Caused by: java.lang.reflect.UndeclaredThrowableException
>         at $Proxy218.get(Unknown Source)
>         at 
> com.keybroker.services.publish.google.GoogleDownloadCampaignBudgetService$2.call(GoogleDownloadCampaignBudgetService.java:66)
>         at 
> com.keybroker.services.publish.google.GoogleDownloadCampaignBudgetService$2.call(GoogleDownloadCampaignBudgetService.java:63)
>         at 
> com.keybroker.services.GoogleSoapDownloadService$1.call(GoogleSoapDownloadService.java:32)
>         at 
> com.keybroker.services.GoogleSoapDownloadVisitorService$1.doRetryingSoapCall(GoogleSoapDownloadVisitorService.java:35)
>         at 
> com.keybroker.services.GoogleSoapDownloadVisitorService$1.doRetryingSoapCall(GoogleSoapDownloadVisitorService.java:33)
>         at 
> com.keybroker.util.SoapCallerImpl.executeWithExceptionHandler(SoapCallerImpl.java:38)
>         ... 26 more
> Caused by: com.google.api.ads.common.lib.exception.OAuthException: OAuth2 
> token could not be refreshed.
>         at 
> com.google.api.ads.common.lib.auth.AuthorizationHeaderProvider.getOAuth2Header(AuthorizationHeaderProvider.java:104)
>         at 
> com.google.api.ads.common.lib.auth.AuthorizationHeaderProvider.getAuthorizationHeader(AuthorizationHeaderProvider.java:77)
>         at 
> com.google.api.ads.common.lib.soap.AuthorizationHeaderHandler.setAuthorization(AuthorizationHeaderHandler.java:63)
>         at 
> com.google.api.ads.adwords.axis.AdWordsAxisHeaderHandler.setAuthenticationHeaders(AdWordsAxisHeaderHandler.java:125)
>         at 
> com.google.api.ads.adwords.axis.AdWordsAxisHeaderHandler.setHeaders(AdWordsAxisHeaderHandler.java:90)
>         at 
> com.google.api.ads.adwords.axis.AdWordsAxisHeaderHandler.setHeaders(AdWordsAxisHeaderHandler.java:1)
>         at 
> com.google.api.ads.common.lib.client.AdsServiceClient.setHeaders(AdsServiceClient.java:111)
>         at 
> com.google.api.ads.common.lib.soap.SoapServiceClient.invoke(SoapServiceClient.java:92)
>         ... 33 more
> Caused by: com.google.api.client.auth.oauth2.TokenResponseException: 403 
> Forbidden
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
> http://www.w3.org/TR/html4/loose.dtd";><html><head><title>Google-konton</title><meta
>  
> http-equiv="content-type" content="text/html; charset=utf-8"><meta 
> http-equiv="X-UA-Compatible" content="IE=edge" /><meta name="viewport" 
> content="width=device-width, initial-scale=1, minimum-scale=1, 
> maximum-scale=1, user-scalable=0" /><link rel='stylesheet' type='text/css' 
> href='https://ssl.gstatic.com/accounts/o/1893590695-error_page_css_ltr.css
> '>
> <script type="text/javascript" src="
> https://ssl.gstatic.com/accounts/o/4240385162-common_lib.js";></script>
> <style>@media screen and (max-width:500px) {#robot {background: none; 
> min-height: 0; min-width: 0; padding: 0;}#stack_trace {display: none;}}
> #oauth2_request_info_header {background-image: url("
> https://ssl.gstatic.com/accounts/o/blank.gif";);}</style></head><body 
> ><div id="robot"></div><a href="//www.google.com/" id="googlelogo"><img 
> src="//www.google.com/images/logo_sm.gif" alt="Google"></a><p 
> class="large"><b>403.</b> <ins>Det har uppstått ett fel.</ins></p><p 
> class="large">Du har inte behörighet att göra den här begäran.  <ins>Det är 
> allt vi vet.</ins></p></body></html>
>         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.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.OAuth2Helper.refreshCredential(OAuth2Helper.java:56)
>         at 
> com.google.api.ads.common.lib.auth.AuthorizationHeaderProvider.getOAuth2Header(AuthorizationHeaderProvider.java:102)
>         ... 40 more
>
>
> If the user does a manual re-authentication, i.e requests a new 
> access-token, it works until it is time to refresh it. We've had similar 
> problems before, but in those cases it was a Rate Limit Exceeded that 
> caused the TokenResponseException. This cause looks a bit strange as it 
> returns 403 Forbidden.
>
> Any idea what's going on?
>
> Regards
> Magnus Ljung
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

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.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to