YouTube
Create a Google OAuth client and connect a YouTube channel for video uploads.
OpenPost connects a YouTube channel with Google OAuth and uploads one video per YouTube variant. Google controls who can authorize your app and whether API uploads can be public.
What you need
- Set
OPENPOST_APP_URLto your instance's public HTTPS origin. - Use a Google account that has a YouTube channel. Have access to a Google Cloud project where you can enable APIs and configure OAuth.
- Plan for Google's consent-screen verification and YouTube API audit if people outside your test group will use the app. Unverified API projects created after July 28, 2020 have uploads restricted to private viewing.
Set up Google Cloud
-
Create or select a project in Google Cloud Console, then enable YouTube Data API v3 in APIs & Services → Library. Enable YouTube Analytics API too if you will use Analytics.
-
In Google Auth Platform, configure the OAuth consent screen, audience, app details, and authorized domains. Add your own Google account as a test user while the app is in testing. In Data Access, add the scopes below; submit for verification when Google requires it.
-
In Clients (or APIs & Services → Credentials), create an OAuth client ID of type Web application. Add this Authorized redirect URI:
https://post.example.com/api/v1/accounts/youtube/callback -
Save the client and copy its Client ID and Client Secret. Keep the secret in your instance's secret store.
OpenPost requests these scopes. Enter the full URLs in Google Auth Platform when configuring data access:
https://www.googleapis.com/auth/youtube.readonly
https://www.googleapis.com/auth/yt-analytics.readonly
https://www.googleapis.com/auth/youtube.upload
https://www.googleapis.com/auth/youtube
https://www.googleapis.com/auth/youtube.force-sslThe YouTube Analytics API must be enabled before OpenPost can read channel reports.
Comments, replies, and moderation use youtube.force-ssl, including Google's comment moderation endpoint. After upgrading from v7.13.0 or earlier, add this scope in Google Auth Platform and reconnect existing YouTube accounts to grant it. Adding a scope in Google Cloud alone does not update an existing connection.
Google documents YouTube OAuth and the web-server OAuth client flow.
Save the app in OpenPost
Save these credentials with your own domain and app values:
[
{
"provider": "youtube",
"client_id": "your-google-oauth-client-id",
"client_secret": "your-google-oauth-client-secret",
"redirect_uri": "https://post.example.com/api/v1/accounts/youtube/callback"
}
]Connect and test
- In Settings → Workspace → Social accounts, select YouTube. Sign in with the Google account that owns the target channel, grant consent, and choose the channel returned by Google.
- Create a post with one video and select the connected channel. Start with a private upload and confirm that OpenPost reports the result and the video appears in YouTube Studio.
- Set title, description, privacy, and other YouTube options on the variant as needed. Choose No for Made for kids to send an explicit negative audience declaration. Not specified leaves that choice to YouTube's channel settings. Contains synthetic media also accepts an explicit Yes or No; Not specified omits the disclosure.
To let YouTube publish a video at a set time, choose Private and fill YouTube publish time (publish_at) with an RFC 3339 timestamp including a timezone, such as 2030-10-12T12:00:00Z. This is a setting for an individual post, not a reusable Social Set default. OpenPost uploads when you publish the post or when its OpenPost schedule runs. YouTube then makes the video public at its publish time. A time in the past makes it public immediately, as described in the YouTube API reference.
OpenPost reports the post as published once the upload completes, even if YouTube's public release is later. First comments and repost automation follow that upload completion, not YouTube's publish time. Test public visibility separately: Google can keep API uploads private even when OpenPost requests another privacy level.
Optional Comments and replies and Analytics start disabled per channel. Enable them only with the required permissions.
Troubleshoot
| Problem | Check |
|---|---|
| Google blocks consent | Check the consent-screen audience, test-user list, requested scopes, and verification status. |
| No channel appears | Confirm the signed-in Google identity has a channel available to the app and select the right account in Google's chooser. |
| Upload fails or stays private | Confirm YouTube Data API v3 is enabled and read Google's error. A new unverified API project can only upload private videos until it passes the YouTube audit. |
| Redirect mismatch | Compare the authorized redirect URI with the JSON and public OPENPOST_APP_URL exactly. Reconnect after changing scopes. |