SelAromDotNet
SelAromDotNet

Reputation: 4815

Method InterceptAsync in type Google.Apis.Auth.OAuth2.ServiceAccountCredential does not have an implementation

I placed the error message in the title because I scored the web and cannot find a single instance of anyone else having this issue.

I'm attempting to use the google .net api to access analytics data as shown here: http://www.toplinestrategies.com/dotneters/net/accessing-and-querying-google-analytics-via-service-account-c/?lang=en

I've followed everything, having created the credential, pointed to the key file and password, and used the email address as the client id.

but the weird thing is, when I execute the page, it immediately fails with the error in the title.

the offending line of code appears to be this one:

    var credential = new ServiceAccountCredential(
       new ServiceAccountCredential.Initializer(clientId)
       {
           Scopes = new[] { scope }
       }.FromCertificate(certificate));

if i remove that line the page doesn't cause the exception, but if I add it, it fails immediately.

but it skips any breakpoints on that page entirely, so I can't even step into see what or where the error is, as if it is executing before the page even loads.

I suspected it was bad credentials but if i run fiddler I see that there is no traffic passing to google or anywhere, it just fails immediately.

This is very frustrating, has anyone seen this? any ideas what might be wrong? the part that really angers me is that if I set a breakpoint anywhere on the page, even before the failing code, it doesn't hit, but fails immediately, skipping all my breakpoints, how can that be?

the path to the key is correct, the password is correct, and the email client id is correct I triple checked it, and that can't be the problem either because it never even tries to contact google.

I thought perhaps it was read/file permissions to the key but I gave full access to everyone on the file, and the X509Certificate2 loads correctly...

so what the heck else could possibly be wrong here?

thanks

Upvotes: 2

Views: 700

Answers (1)

SelAromDotNet
SelAromDotNet

Reputation: 4815

it turns out the offending line of code was this one in web.config:

  <dependentAssembly>
    <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
  </dependentAssembly>

the version of System.Net.Http in the bin folder was actually 2.1.10. not sure why this didn't crash the whole site instead of that one random component but removing it completely fixed the problem

Upvotes: 2

Related Questions