Appearance
YouTube
Google OAuth 2.0 with offline access. The auth URL passes access_type=offline and prompt=consent to force refresh-token issuance.
Authentication at a glance
| Field | Value |
|---|---|
| Auth model | OAuth 2.0 |
| Required ENV | YOUTUBE_CLIENT_ID, YOUTUBE_CLIENT_SECRET |
| Callback URL | ${BASE_URL}/api/v1/auth/youtube/callback |
| Scopes / permissions | https://www.googleapis.com/auth/youtube.upload, https://www.googleapis.com/auth/youtube.readonly |
| Auto token refresh | Yes — every 7 days before expiry |
How to connect
- Open Connections → YouTube → Connect.
- Sign in to Google and grant
youtube.uploadandyoutube.readonly. - Sosyabot creates one channel record per YouTube channel discovered.
Token refresh
Auto-refreshed. Default access-token TTL is 1 hour. The tokenRefresh.queue.ts worker uses the stored refresh_token to mint new access tokens before posts run.
Notes
- If the OAuth consent returns multiple YouTube channels, Sosyabot creates one Sosyabot channel per YouTube channel. The connect callback iterates
youtube.channels.listand saves each. - YouTube Data API v3 daily quota is 10000 units by default. Each video upload costs 1600 units — that's ~6 uploads/day on the default quota. Request a quota increase from Google for production volume.
- The token record stores
channelIdandchannelTitle; thumbnail URLs are cached indatafor the connections list UI.
Troubleshooting
If the channel shows needs_reconnect, the access token was rejected by YouTube. Common causes:
- The user revoked Sosyabot's authorization on the platform.
- The platform invalidated the token (password change, security event).
- Your OAuth app credentials rotated and the existing tokens no longer match.
Re-run the connect flow above. See Troubleshooting for the workspace-wide checklist.