Youtube API: Comment Insert 403 forbidden insufficient permissions

情到浓时终转凉″ 提交于 2019-12-23 17:18:05

问题


I'm using the API explorer at the bottom of https://developers.google.com/youtube/v3/docs/commentThreads/insert to test this call. I am requesting the scope https://www.googleapis.com/auth/youtube.force-ssl. Appreciate any help!

REQUEST:

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"
 }
}

RESPONSE:

{
 "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."
 }
}

回答1:


The video was private.... Worked fine on a public video.




回答2:


I had a similar problem. I needed to set the token in the header. the request body needs to have:

part: "snippet"

I think you also would need to set a header of:

Authorization: 'Bearer ' + access_token



回答3:


I uploaded a video and by default the comments were disabled. Once I changed to "Allow all comments" I could post via the API.



来源:https://stackoverflow.com/questions/35047038/youtube-api-comment-insert-403-forbidden-insufficient-permissions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!