Skip to content

YouTube API Setup

Admin walkthrough for the YouTube integration. End-user flow: Connections → YouTube.

Overview

Form fieldOptions key
Client IDyoutube_client-id
Client Secretyoutube_client-secret
Statusyoutube_integration_status

ENV fallback: YOUTUBE_CLIENT_ID + YOUTUBE_CLIENT_SECRET.

Step-by-step on console.cloud.google.com

1. Create or pick a Google Cloud project

https://console.cloud.google.com → top project switcher → New Project. Pick a billing account if prompted (YouTube Data API has a free quota tier — billing is needed only if you exceed it).

2. Enable YouTube Data API v3

In the project, APIs & Services → Library → search "YouTube Data API v3" → Enable.

APIs & Services → OAuth consent screen. User type: External (allows any Google user to authorize). Fill in:

  • App name (e.g. "Sosyabot")
  • User support email
  • Developer contact email
  • App home page: https://sosyabot.com
  • Authorized domains: sosyabot.com

Click Save and continue through scopes (skip — we'll request them via the API), test users (add yourself for development), and submit.

Verification required for production

For production use you'll need to submit the app for Google verification (the youtube.upload scope is in the sensitive scopes list). Until verified, you're capped at 100 test users.

4. Create OAuth 2.0 Client ID

APIs & Services → Credentials → Create Credentials → OAuth client ID.

  • Application type: Web application.
  • Name: e.g. "Sosyabot Web"
  • Authorized redirect URIs:
    https://app.sosyabot.com/api/v1/auth/youtube/callback
  • Save.

The dialog now shows Your Client ID and Your Client Secret — copy both. You can re-download the JSON later but the secret IS visible again, unlike X.

Pasting into Sosyabot admin panel

/admin/api-integration/youtube. Paste, Enable, Save, Test credentials.

Failure: YouTube integration disabled: client id/secret not configured.

Verification

/app/channels → Connect → YouTube → OAuth → consent (you'll see scope warning about uploading videos) → approve. If the Google account owns multiple YouTube channels, Sosyabot creates one Sosyabot channel per YouTube channel.

Upload a short test video from /app/publishing (cap ~10s) — confirm it appears in the YouTube channel's Your videos page (uploads are private by default until confirmed).

Troubleshooting

SymptomCauseFix
YouTube integration disabled: client id/secret not configuredAdmin + ENV emptySteps 1–4.
Access blocked: Authorization Error on consentApp in Testing mode and the user isn't a test userAdd the user as a test user OR submit for verification.
Quota exceeded after a handful of uploadsDefault daily quota is 10,000 units; each upload costs 1,600Request a quota increase in Google Cloud Console.
Token refreshes failing in worker logsRefresh token revoked (user removed app from Google Account)User must reconnect from /app/channels.

ENV fallback

YOUTUBE_CLIENT_ID=<your client id>
YOUTUBE_CLIENT_SECRET=<your client secret>

After editing .env run ./service.sh restart api.