错误:“消息”:“需要登录”当使用Youtube Analytics API时 [英] Error: "message": "Login Required" when use Youtube Analytics API

查看:280
本文介绍了错误:“消息”:“需要登录”当使用Youtube Analytics API时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用youtube api。当我点击此网址时 https://www.googleapis.com/youtube/analytics/v1/reports?ids=channel%3D%3DMINE& ; start-date = 2015-01-01& end-date = 2016-01-31& metrics = likes%2Cdislikes& key = {API Key}



给出401

  {
错误:{
错误:[
{
domain:global,
reason:required,
message:需要登录,
locationType:header,
location:Authorization
}
],
code:401,
message:需要登录
}
}

但我在资源管理器中找到 https://developers.google.com/apis-explorer/
它工作正常。

如何使第一个请求有效?

解决方案

您的请求发送key = {your key}给您应该发送的访问令牌access_token = {您的oauth2访问令牌}

注意:密钥用于公共请求。访问令牌用于已认证的请求。


I am working with youtube api. when I hit this url "https://www.googleapis.com/youtube/analytics/v1/reports?ids=channel%3D%3DMINE&start-date=2015-01-01&end-date=2016-01-31&metrics=likes%2Cdislikes&key={API Key}"

it gives 401

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "required",
    "message": "Login Required",
    "locationType": "header",
    "location": "Authorization"
   }
  ],
  "code": 401,
  "message": "Login Required"
 }
}

but I hited in the explorer "https://developers.google.com/apis-explorer/?" it working fine.
How do I make the first request work?

解决方案

In your request you are sending key={your key} for an access token you should be sending access_token={your oauth2 access token}

Note: Key is used for public requests. access token is for authenticated requests.

这篇关于错误:“消息”:“需要登录”当使用Youtube Analytics API时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆