错误:“消息”:“需要登录”当使用Youtube Analytics API时 [英] Error: "message": "Login Required" when use 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屋!