Youtube API:注释插入 403 禁止权限不足



我正在使用 https://developers.google.com/youtube/v3/docs/commentThreads/insert 底部的 API 资源管理器来测试此调用。我要求范围 https://www.googleapis.com/auth/youtube.force-ssl。感谢任何帮助!

请求:

POST https://www.googleapis.com/youtube/v3/commentThreads?part=id%2Csnippet&fields=id&key={YOUR_API_KEY}
{
 "snippet": {
  "topLevelComment": {
   "snippet": {
    "textOriginal": "comment from gdev"
   }
  },
  "videoId": "B5BypNLbBgQ",
  "channelId": "UCNqqFgLtbSjc9Er7XFv4wbA"
 }
}

响应:

{
 "error": {
  "errors": [
   {
    "domain": "youtube.commentThread",
    "reason": "forbidden",
    "message": "The comment thread could not be created due to insufficient permissions. The request might not be properly authorized.",
    "locationType": "other",
    "location": "body"
   }
  ],
  "code": 403,
  "message": "The comment thread could not be created due to insufficient permissions. The request might not be properly authorized."
 }
}

视频是私人的。在公共视频上工作正常。

我也有类似的问题。我需要在标头中设置令牌。请求正文需要具有:

part: "snippet"

我认为您还需要设置以下标题:

Authorization: 'Bearer ' + access_token

我上传了一个视频,默认情况下评论被禁用。一旦我更改为"允许所有评论",我就可以通过 API 发布。

最新更新