Hi Boris,

The error "Failed to refresh access token" means that your refreshToken is 
probably expired. There might be an issue with your OAuth2 Credentials. I 
would recommend to regenerate a new set of credentials by following this 
guide <https://developers.google.com/adwords/api/docs/guides/authentication> 
and 
update your ads.properties with the newly created credentials.

After this, you could retry making your service calls. If it still does not 
work, kindly provide the error logs so I could investigate this further.

Regards,
Dannison
AdWords API Team

On Friday, January 4, 2019 at 5:33:01 AM UTC+8, bberlin wrote:
>
> Hello, we are migrating from AdWords API v201708  to  v201809.  
>
> We do uninstall NuGet v201708   and installed v201809, and replaced 
> "using" -s to v201809.
>
> The build passed without any errors or warnings.  However when we run the 
> code we got an the run-time shows an error of 
>
> "AdsOAuthException: Failed to refresh access token"   ( I put the full  
> Exception stack dump below).
>
> Why do we have it , if the same code at the same time now , linked with 
> v201708   works out without any errors.
>
> I also put the code snippet below the Exception stack dump in order to 
> show the idea if the call, 
>
> in spite it should not be much matter, since the same works out  for v201708  
>  .
>
> Regards,
>
> Boris
>
> == *Exception stack * ===============
>
> Google.Api.Ads.Common.Lib.AdsOAuthException: Failed to refresh access token. 
> ---> System.AggregateException: One or more errors occurred. ---> 
> Google.Apis.Auth.OAuth2.Responses.TokenResponseException: 
> Error:"invalid_client", Description:"The OAuth client was not found.", Uri:""
>    at 
> Google.Apis.Auth.OAuth2.Requests.TokenRequestExtenstions.<ExecuteAsync>d__0.MoveNext()
> --- End of stack trace from previous location where exception was thrown ---
>    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task 
> task)
>    at 
> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
>  task)
>    at 
> Google.Apis.Auth.OAuth2.Flows.AuthorizationCodeFlow.<FetchTokenAsync>d__35.MoveNext()
> --- End of stack trace from previous location where exception was thrown ---
>    at 
> Google.Apis.Auth.OAuth2.Flows.AuthorizationCodeFlow.<FetchTokenAsync>d__35.MoveNext()
> --- End of stack trace from previous location where exception was thrown ---
>    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task 
> task)
>    at 
> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
>  task)
>    at 
> Google.Apis.Auth.OAuth2.Flows.AuthorizationCodeFlow.<RefreshTokenAsync>d__31.MoveNext()
> --- End of stack trace from previous location where exception was thrown ---
>    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task 
> task)
>    at 
> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
>  task)
>    at 
> Google.Apis.Auth.OAuth2.UserCredential.<RefreshTokenAsync>d__16.MoveNext()
> --- End of stack trace from previous location where exception was thrown ---
>    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task 
> task)
>    at 
> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
>  task)
>    at 
> Google.Apis.Auth.OAuth2.TokenRefreshManager.<RefreshTokenAsync>d__12.MoveNext()
> --- End of stack trace from previous location where exception was thrown ---
>    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task 
> task)
>    at 
> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
>  task)
>    at 
> Google.Apis.Auth.OAuth2.TokenRefreshManager.<GetAccessTokenForRequestAsync>d__10.MoveNext()
>    --- End of inner exception stack trace ---
>    at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean 
> includeTaskCanceledExceptions)
>    at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, 
> CancellationToken cancellationToken)
>    at 
> Google.Api.Ads.Common.OAuth.AdsOAuthProviderImpl.GetAccessTokenForAuthorizationCodeFlow()
>    at 
> Google.Api.Ads.Common.OAuth.AdsOAuthProviderImpl.RefreshAccessTokenInOfflineMode()
>    --- End of inner exception stack trace ---
>
> Server stack trace:
>    at 
> Google.Api.Ads.Common.OAuth.AdsOAuthProviderImpl.RefreshAccessTokenInOfflineMode()
>    at Google.Api.Ads.Common.OAuth.AdsOAuthProviderImpl.RefreshAccessToken()
>    at Google.Api.Ads.Common.OAuth.AdsOAuthProviderImpl.GetAuthHeader()
>    at 
> Google.Api.Ads.Common.OAuth.OAuthClientMessageInspector.BeforeSendRequest(Message&
>  request, IClientChannel channel)
>    at 
> System.ServiceModel.Dispatcher.ImmutableClientRuntime.BeforeSendRequest(ProxyRpc&
>  rpc)
>    at 
> System.ServiceModel.Channels.ServiceChannel.PrepareCall(ProxyOperationRuntime 
> operation, Boolean oneway, ProxyRpc& rpc)
>    at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean 
> oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, 
> TimeSpan timeout)
>    at 
> System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage
>  methodCall, ProxyOperationRuntime operation)
>    at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage 
> message)
>
> Exception rethrown at [0]:
>    at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage 
> reqMsg, IMessage retMsg)
>    at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& 
> msgData, Int32 type)
>    at 
> Google.Api.Ads.AdWords.v201809.ManagedCustomerServiceInterface.get(Selector 
> serviceSelector)
>    at Google.Api.Ads.AdWords.v201809.ManagedCustomerService.get(Selector 
> serviceSelector)
>
> ==  ======
>
> === * Code snippet* -- 
>
> using Google.Api.Ads.AdWords.Lib;
> using Google.Api.Ads.AdWords.Util.Reports;
> using Google.Api.Ads.AdWords.v201809;
> using Google.Api.Ads.Common.Lib;
> using Google.Api.Ads.Common.Util.Reports;
>
> ........
>
> ........
>
> // Get the ManagedCustomerService.
>             ManagedCustomerService managedCustomerService = 
> (ManagedCustomerService)m_st_adUser.GetService(
>                 AdWordsService.v201809.ManagedCustomerService);
>
>             // Create selector.
>             Selector selector = new Selector();
>             selector.fields = new String[] {
>           ManagedCustomer.Fields.CustomerId, ManagedCustomer.Fields.Name
>       };
>             selector.paging = Paging.Default;
>
>             // Map from customerId to customer node.
>             Dictionary<long, ManagedCustomerTreeNode> 
> customerIdToCustomerNode =
>                 new Dictionary<long, ManagedCustomerTreeNode>();
>
>             // Temporary cache to save links.
>             List<ManagedCustomerLink> allLinks = new 
> List<ManagedCustomerLink>();
>
>             ManagedCustomerPage page = null;
>             try
>             {
>                 do
>                 {
>                     page = managedCustomerService.get(selector);
>
> .......
>
>
>
>
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
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 and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
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/6550f1c6-c8ed-472c-a06c-d2d6babf8364%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • ... bberlin
    • ... 'Dannison Yao (AdWords API Team)' via AdWords API and Google Ads API Forum

Reply via email to