我正在使用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密鑰}」錯誤:使用YouTube分析API時出現「message」:「需要登錄」
它給了401
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
,但我在瀏覽器hited 「https://developers.google.com/apis-explorer/?」 它工作正常。
如何使第一個請求生效?
您應該解決您的問題,這是對YouTube分析API的請求。您需要使用Oauth2對該請求進行身份驗證。 – DaImTo
我已經有了來自Oauth的訪問令牌的不同意思。現在我如何獲得這些數據? –
請嘗試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&access_token={access來自oauth的令牌} – DaImTo