about the refresh token

103 views
Skip to first unread message

advisor managers

unread,
Aug 6, 2018, 6:25:56 AM8/6/18
to adwor...@googlegroups.com
hi peter

well i try to get my refresh key but i have a problem with that .
i use a visual studio and i need that api for my website i cant execute the ConsoleExample.cs 
to get my refresh key 
what should i do?

that the problem that i get :

Google.Api.Ads.Common.Lib.AdsOAuthException
  HResult=0x80131500
  Message=Failed to refresh access token. See inner exception for details.
  Source=<Cannot evaluate the exception source>
  StackTrace:
<Cannot evaluate the exception stack trace>

Inner Exception 1:
AggregateException: One or more errors occurred.

Inner Exception 2:
TypeInitializationException: The type initializer for 'Google.Apis.Json.NewtonsoftJsonSerializer' threw an exception.

Inner Exception 3:
FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)



thanks dian

Teja Makani

unread,
Aug 6, 2018, 3:47:23 PM8/6/18
to AdWords API and Google Ads API Forum
Hello Dian,

Could you please confirm whether you followed OAuth2 authentication guide to setup OAuth credentials? the refresh token must be created using the credentials of the same account that is used to generate OAuth credentials at the same time the account must have access to the account you are making API calls to get campaigns. If the problem still persists, could you please share the complete error logs along with the .net client library version you are using to investigate further on this issue?   

Regards,
Sai Teja, AdWords API Team.

rogerccopa

unread,
Sep 25, 2018, 8:22:44 PM9/25/18
to AdWords API and Google Ads API Forum
Hi,
I am having the same issue (with the latest AdWords .NET libray v24.0.1):

 "Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0..."
at Google.Api.Ads.Common.OAuth.AdsOAuthProviderImpl.RefreshAccessTokenInOfflineMode().

Just in case, I have already installed (with NuGet) Newtonsoft.Json v11.0.2 and if I try to downgrade it it tries to downgrade also the Google AdWords library which I don't want.
Did anybody else have this issue? any help how to solve it?

Thanks.

rogerccopa

unread,
Sep 26, 2018, 12:43:58 PM9/26/18
to AdWords API and Google Ads API Forum
I figured out the fix to this issue.

I added the following to the .config file:
<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

And, now it works.
Just in case anyone else runs into this same issue.

Teja Makani

unread,
Sep 26, 2018, 2:38:02 PM9/26/18
to AdWords API and Google Ads API Forum
Hello,

Glad you are able to figure of the fix and thanks for sharing your solution.

Regards,
Sai Teja, AdWords API Team.

On Monday, August 6, 2018 at 6:25:56 AM UTC-4, advisor managers wrote:
Reply all
Reply to author
Forward
0 new messages