c# - 如何使用 DotnetOpenAuth 检索配置文件 ID

标签 c# asp.net dotnetopenauth

如何使用 DotnetOpenAuth 检索配置文件 ID 从 Google Analytics API 获取数据。

我得到了 oAuth token 但是当试图使用这个 token 检索数据时, 我收到异常 - 执行失败错误。

The request 'Google.Apis.Requests.Request(list @ https://www.googleapis.com/tasks/v1/users/@me/lists?alt=json&prettyPrint=true)' has failed. The service tasks has thrown an exception: Google.GoogleApiRequestException: The remote server returned an error: (401) Unauthorized. ---> System.Net.WebException: The remote server returned an error: (401) Unauthorized.
  at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
  at Google.Apis.Requests.Request.InternalEndExecuteRequest(IAsyncResult asyncResult) in c:\google\6-21-2012\default\Src\GoogleApis\Apis\Requests\Request.cs:line 327
  --- End of inner exception stack trace ---
  at Google.Apis.Requests.Request.AsyncRequestResult.GetResponse() in c:\google\6-21-2012\default\Src\GoogleApis\Apis\Requests\Request.cs:line 301
  at Google.Apis.Requests.ServiceRequest`1.GetResponse() in c:\google\6-21-2012\default\Src\GoogleApis\Apis\Requests\ServiceRequest.cs:line 183
  at Google.Apis.Requests.ServiceRequest`1.Fetch() in c:\google\6-21-2012\default\Src\GoogleApis\Apis\Requests\ServiceRequest.cs:line 203
  at GoogleAnalyticsNew._Default.FetchTaskslists() in E:\Anagha\GA\GoogleAnalyticsNew\GoogleAnalyticsNew\Default.aspx.cs:line 186

谁能帮帮我。

提前致谢

最佳答案

您应该使用您的 API key 询问信息,如下所示:

GET https://www.googleapis.com/tasks/v1/users/@me/lists/test?key={YOUR_API_KEY}

您可以使用 Tasks API here .

如果您不知道您的 API key ,您可以在 API Console 中找到它.

关于c# - 如何使用 DotnetOpenAuth 检索配置文件 ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11433524/

相关文章:

c# - 如何对 List(Of Integer()) 进行区分?

c# - 创建自定义列类型?

c# - 将生成的 pdf 文件而不保存在服务器上

asp.net - 如何从asp.net core中的Microsoft帐户获取外部登录配置文件图片

c# - 如何创建单个 Web 应用程序作为许多公司的子域

c# - 为什么这个 DataTrigger 不起作用?

c# - 使用 Newtonsoft 将 Json 反序列化为 C# 中的对象列表

gmail - 通过 DotNetOpenId 检索 GMail 数据

c# - DotNetOpenAuth:何时调用 StoreNewRequestToken?

c# - 使用 DotNetOpenAuth 的两条腿 OAuth