【发布时间】:2013-09-09 15:07:39
【问题描述】:
我正在使用带有服务帐户的 Google API 的最新 beta 1.5 (1.5.0.28991),并且在进行身份验证时在 AssertionFlowClient 行上遇到此错误:
找不到方法:'Void DotNetOpenAuth.OAuth2.ClientBase..ctor(DotNetOpenAuth.OAuth2.AuthorizationServerDescription, System.String, System.String)'。
DotNetOpenAuth V4.3.1.13153
AuthorizationServerDescription desc = GoogleAuthenticationServer.Description;
X509Certificate2 key = new X509Certificate2(key_file, key_pass, X509KeyStorageFlags.Exportable);
AssertionFlowClient client = new AssertionFlowClient(desc, key) { ServiceAccountId = client_id, Scope = scope };
我对此很头疼 - 任何指点都将不胜感激。
【问题讨论】:
-
很难说到底是什么问题。您是否添加了对 Google.Apis 和 Google.Apis.Authentication 的 NuGet 引用?您可以尝试编译我们的 Plus 示例 (code.google.com/p/google-api-dotnet-client/source/browse/…) 吗?它也使用服务帐户。让我知道它是否有效,如果有效 - 尝试继续并更改代码以适应分析 API。
-
谢谢你,peleyal。我错过了 Google.Apis.Authentication,您的建议和下面的答案帮助我解决了问题。
标签: asp.net google-analytics oauth-2.0 google-api-dotnet-client