struggling to authenticate在Google+ API后,我终于成功找回我的信息与https://www.googleapis.com/plus/v1/people/ {MyUserId}?关键= {ApiKey}Google+的API让人们“我”
然而,尽管我没有获得与访问令牌范围https://www.googleapis.com/auth/plus.me我不能请求“我”:https://www.googleapis.com/plus/v1/people/me?key= {ApiKey}
我最终得到401未经授权的请求......这是迟到了,我没有得到我想念的东西。
这里是我的代码:
string apiUrl = "https://www.googleapis.com/plus/v1/people/me?key={my api key";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(apiUrl);
request.Method = HttpMethod.GET.ToString();
try
{
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
=> 401 error
谢谢您的帮助!
尝试排除API密钥,一旦您获得了OAuth令牌 - [People:get](http://developers.google.com/+/api/latest/people/get#examples) _:“”如果使用userId值“me”,则此方法需要使用已授予OAuth范围的令牌进行认证“”._ [OAuth](http://developers.google.com/+/api/oauth ):_“”如果请求需要授权(例如对个人私人数据的请求),则它必须包含OAuth 2.0令牌。它也可能包含API密钥,但它不一定要。“”_ – Smudge202
您需要像这样请求:'“https://www.googleapis.com/plus/v1/people/me?key={api key}&access_token = {access token}“' –