How to post a comment to youtube in n8n ver 2.26.8

I got an error when using node http to connect to youtube to push a comment to youtube. I connected to YouTube but it still shows an error Forbidden - perhaps check your credentials?

The comment cannot be created due to insufficient permissions. The request might not be properly authorized.

Hope to have an answer from everyone

@Hieu that forbidden, insufficient permissions on the comment insert is a scope issue, posting comments needs the youtube.force-ssl scope and your token got minted without it. n8ns youtube oauth2 cred does request force-ssl, but your existing connection predates it or the scope wasnt approved at the consent screen. revoke n8ns access in your google account, then disconnect and reconnect the youtube credential and approve all the scopes, that remints the token with force-ssl and the insert works.

Can you describe more clearly? I turned off the connection to Google and reconnected it, but Google didn’t ask for new permission

@Hieu thats the giveaway, the app already has access so google skips the scope prompt and hands back the old token without force-ssl. revoke it properly: go to myaccount.google.com/permissions, find the app (test) and remove its access, then reconnect in n8n. now google shows the full consent, and since the app is unverified the youtube permissions appear as checkboxes that start unchecked, so tick the one granting manage your youtube account (force-ssl) before continuing, dont just hit allow. that mints a token with the write scope and the comment posts.

@Hieu

Do this

  1. Go to Credentials in your n8n left-hand menu.
  2. Find and open your YouTube OAuth2 API credential.
  3. Look for the Scopes field. You likely have a “read-only” scope or a limited one.
  4. Add the following scope (separated by a comma if there are others): https://www.googleapis.com/auth/youtube (Or https://www.googleapis.com/auth/youtube.force-ssl for full access).
  5. Save the credential.

Since Google is skipping the permission screen, you need to manually revoke access so it’s forced to show the new checkboxes:

  1. Go to your Google Account Permissions page.
  2. Find the app named “test” (as seen in your screenshot).
  3. Click it and select “Remove Access.”

Lastly

  1. Go back to your n8n YouTube credential.
  2. Click Reconnect (or “Connect my account”).
  3. Now, when the Google window pops up, it will no longer say “already has some access.” Instead, it will show you a list of permissions.
  4. CRITICAL: You must manually check the box that says “Manage your YouTube account” or “Post comments on YouTube.” If you just click “Continue” without checking the boxes, you will get the same Forbidden error.