1

I have an API Key and a Bearer Token. I am able to list comments, insert comments and delete comments but I am not able to update comments.

API:

PUT https://www.googleapis.com/youtube/v3/comments

Body:

{
    "snippet": {
        "textOriginal": "Text"
    },
    "id": "..."
}

Response:

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

On my own channel, I was able to do it but I wasn't in other channels =/

One of the videos that I used to try it: https://www.youtube.com/watch?v=cahbnnv2Hwk

Do I need some kind of special authorization to be able to update my comment through an API? I am able to manually edit the comment.

Thank you =]

TheMaster
  • 45,448
  • 6
  • 62
  • 85
SamuraiExx
  • 96
  • 3
  • I added an issue on them. It was forwarded to the engineering team. https://issuetracker.google.com/issues/203111370 – SamuraiExx Oct 21 '21 at 18:02

1 Answers1

1

The comment could not be updated due to insufficient permissions.

There are two possible causes for this error. IMO your probably looking at the first.

Wrong scope of consent

Is due to the fact that the consent that you have from the user is not high enough for this method.

The method comments.update operates on private user data which means that you need the users consent in order to be able to use this method. That is what your bearer token does it should give you consent from the user.

If you check the documentation you will find that this method requires consent with the following scope

enter image description here

This is just one of a number of scopes that the YouTube Data api supports. These scopes define what access your application needs. Scopes

If you requested consent of the user with any scope other then https://www.googleapis.com/auth/youtube.force-ssl you will get the error message "insufficient permissions" because you don't have permission.

Low level user

The second possibility is that the user themselves may only have read permission on the YouTube channel account, and there for can not give you permission to update comments. TBH im not even sure that you can only grant read access to a user in YouTube, however i thought this possibility was worth mentioning.

As you state On my own channel, I was able to do it but I wasn't in other channels this may in fact be the problem. I'm not sure who the owner is of these "other channels" so you may want to try and contact the owner and see if they cant give you additional access.

However if you are trying to update a comment that you personally created on someone else channel. I personally wonder if this is even possible. Who has permission to edit the comment via the api would be a good question. The owner of the channel or the user that created it. I may have to test this.

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
  • Hm, just to clarify, I am trying to edit my own comment only. I understand that possibly I can't edit but I can still create/delete my own comments on other channels. Also, I did not find anything explicitly saying that I should not be able to do that. Thanks for your answer =] Btw, I don't think that's a problem with the scope permission as the same scope is necessary to add/delete. – SamuraiExx Oct 15 '21 at 16:35
  • I agree about the lack of documentation that's why i put up a fix the documentation [Issue](https://issuetracker.google.com/issues/203114199) on the forums – Linda Lawton - DaImTo Oct 15 '21 at 16:54