Google OAuth2 “ServiceAccountCredential” does not

2019-07-26 17:24发布

问题:

I had a ServiceAccount hookup in my .NET Core RC1 app that worked fine. However now, "ServiceAccountCredential" doesn't exist in "Google.APIs.Auth.OAuth2" anymore. The whole library seems to be missing a ton of classes in the RTM version of Core.

Here are the related packages in my project.json

"Google.Apis.Core": "1.14.0",
"Google.Apis.Auth": "1.14.0",
"Google.Apis.Oauth2.v2": "1.14.0.540"

I even tried using the RC1 packages, but I keep getting the same thing. Is it simply because Google Auth isn't fully supported in Core yet?

回答1:

The Google API's indeed do not fully support .NET Core yet: https://github.com/google/google-api-dotnet-client/issues/695.

In fact the ServiceAccountCredential is problematic (as I mentioned here) since it calls Windows-specific API's to parse the certificate. It has to be implemented cross-platform first to fully support .NET Core (.NET Standard actually).