You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用内容管理器账号调用YouTube Data API channels.list(managedByMe)持续报403

YouTube Data API v3调用channels.list返回403禁止访问问题

我正在开发一个Node.js应用,对接YouTube Data API v3,尝试列出我的YouTube内容所有者账号管理的频道,但反复排查后仍持续收到403访问禁止错误。

调用youtube.channels.list({ part: 'id,snippet,statistics', managedByMe: true })时,API返回:

获取频道列表失败:访问被禁止,请求可能未正确授权。

API错误详情:

API Error Details: {
  code: 403,
  message: 'Access forbidden. The request may not be properly authorized.',
  errors: [
    {
      message: 'Access forbidden. The request may not be properly authorized.',
      domain: 'youtube.common',
      reason: 'forbidden'
    }
  ]
}

已采取的排查步骤

  • 认证账号权限:我的Google账号(iconstats@gmail.com)已确认拥有“YouTube Studio”界面中“MovieBox Record Label”内容所有者的“内容管理器”权限,可手动登录管理该内容所有者的内容。
  • OAuth权限范围:Node.js应用已配置请求以下权限范围,且OAuth同意屏幕确认已授予:
    • https://www.googleapis.com/auth/yt-analytics.readonly
    • https://www.googleapis.com/auth/youtube.readonly
    • https://www.googleapis.com/auth/youtubepartner
      最近的认证日志显示已成功获取包含所有这些范围的access_token和refresh_token。
  • 认证流程:使用Node.js中的google.auth.OAuth2客户端,流程包括生成认证URL、在浏览器中打开获取用户同意、处理oauth2callback交换代码获取令牌、保存tokens.json、调用API前设置oauth2Client.setCredentials(tokens)。已多次删除tokens.json并重新认证以确保获取包含所有范围的新令牌。
  • API调用代码:相关Node.js代码如下:
const { google } = require("googleapis");
const oauth2Client = /* ... initialized oauth2Client ... */ ; // (credentials set from tokens.json)

const youtube = google.youtube({
    version: "v3",
    auth: oauth2Client,
});

try {
    const responseManagedByMe = await youtube.channels.list({
        part: "id,snippet,statistics",
        managedByMe: true,
        maxResults: 50,
    });
    // ... handle successful response ...
} catch (error) {
    // ... logs the 403 error above ...
}

核心疑问

既然iconstats@gmail.com账号在YouTube UI中拥有内容管理器权限,且应用已成功获取带有youtubepartner范围的令牌,为何调用channels.list并设置managedByMe: true时仍收到403访问禁止错误?内容所有者通过API列出托管频道是否需要特定的项目级审批、白名单或不同的API方法/参数组合?

内容的提问来源于stack exchange,提问作者Saminathan K

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.12 14:13:27