From 74e2b91228b4c02204fac74e515e4ed0bd3b046c Mon Sep 17 00:00:00 2001 From: eric Date: Tue, 11 Aug 2026 19:30:26 -0500 Subject: [PATCH] Narrow YouTube OAuth scopes to upload+readonly. Drop youtubepartner/analytics scopes that commonly break unverified Google consent with a 500 page. Co-authored-by: Cursor --- backend/app/shorts_oauth.py | 11 +++-------- .../src/components/GoogleOauthSetupWizard.tsx | 17 +++++++---------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/backend/app/shorts_oauth.py b/backend/app/shorts_oauth.py index 2308f78..cf00767 100644 --- a/backend/app/shorts_oauth.py +++ b/backend/app/shorts_oauth.py @@ -19,16 +19,11 @@ from . import db YOUTUBE_SCOPES = " ".join( [ - # Full channel management (playlists, captions-ish surface, live bindings, etc.) - "https://www.googleapis.com/auth/youtube", - "https://www.googleapis.com/auth/youtube.force-ssl", - # Explicit upload + readonly (kept for clarity / older clients) + # Minimal set for Shorts upload + channel identity. + # Avoid youtubepartner / yt-analytics here — they often break + # unverified OAuth consent (Google 500 / access_denied). "https://www.googleapis.com/auth/youtube.upload", "https://www.googleapis.com/auth/youtube.readonly", - # Partner / brand-account surfaces when available - "https://www.googleapis.com/auth/youtubepartner", - # Channel analytics (non-monetary) - "https://www.googleapis.com/auth/yt-analytics.readonly", ] ) diff --git a/frontend/src/components/GoogleOauthSetupWizard.tsx b/frontend/src/components/GoogleOauthSetupWizard.tsx index f69d9b6..c868e3d 100644 --- a/frontend/src/components/GoogleOauthSetupWizard.tsx +++ b/frontend/src/components/GoogleOauthSetupWizard.tsx @@ -132,21 +132,18 @@ export function GoogleOauthSetupWizard({
    -
  1. 弹出页里启用 YouTube Data API v3(建议同时启用 YouTube Analytics API)
  2. +
  3. 弹出页里启用 YouTube Data API v3
  4. - 同意屏幕选 External,加你自己为 Test user;Scopes 尽量加全: - youtube、 - youtube.force-ssl、 - youtube.upload、 - youtube.readonly、 - youtubepartner、 - yt-analytics.readonly + 同意屏幕选 External;Scopes 只需: + youtube.upload、 + youtube.readonly + (不要加 youtubepartner / yt-analytics,未验证应用容易在同意页 500)
  5. 创建 Web application,重定向 URI 填下面这行(先复制)
  6. -
  7. 把 Client ID / Secret 粘贴到下方 → 保存
  8. -
  9. 权限变更后,到 Shorts 页对每个频道点「重新授权」才会拿到新 scope
  10. +
  11. 把 Client ID / Secret 粘贴到设置里对应的 A/B/C/D 配置档 → 保存
  12. +
  13. Shorts 频道选择配置档后点「授权」;权限变更后需重新授权