如何使用 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/