You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Added Google Cloud, YouTube Data API, Google Auth Platform, OAuth client, device-code authorization, validation, and common-error instructions for fresh deployments.
8
+
- Documented the `org_internal`, `invalid_client`, testing-mode token expiry, and channel-permission failure modes observed during setup.
9
+
5
10
## 2026-07-06 - Executive Summary Documentation
6
11
7
12
- Expanded the README into an executive summary covering architecture, runtime process flow, operational commands, recovery behavior, and caveats.
The OBS service file supplies the reusable YouTube RTMPS server and stream key. If YouTube AutoEncoder creates a reusable stream through the API, it updates that service file.
215
215
216
-
## YouTube Authorization
216
+
## YouTube API and OAuth Provisioning
217
217
218
-
Create a Google OAuth client and place the downloaded JSON at:
218
+
YouTube AutoEncoder needs OAuth, not just an API key. The service creates and manages private YouTube resources such as `liveBroadcast` and `liveStream`, binds them together, and transitions broadcasts through `testing`, `live`, and `complete`. Those operations must be authorized by the Google account that owns or manages the YouTube channel.
219
+
220
+
Official references:
221
+
222
+
-[YouTube Live Streaming API Overview](https://developers.google.com/youtube/v3/live/getting-started)
1. Sign in to YouTube Studio with the Google account that owns or manages the channel.
231
+
2. Confirm that live streaming is enabled for the channel. New channels, restricted channels, or channels with policy holds may not be able to stream immediately.
232
+
3. If the channel is a Brand Account, authorize with a Google account that can manage that Brand Account.
233
+
234
+
### 2. Create or Select a Google Cloud Project
235
+
236
+
1. Open the [Google Cloud Console](https://console.cloud.google.com/).
237
+
2. Create a new project for the encoder, or select an existing project dedicated to this deployment.
238
+
3. Open **APIs & Services > Library**.
239
+
4. Enable **YouTube Data API v3** for the project.
240
+
241
+
The Live Streaming API is exposed through the YouTube Data API v3 for the broadcast and stream operations this project uses.
242
+
243
+
### 3. Configure Google Auth Platform
244
+
245
+
Open **Google Auth Platform** for the same project and configure the app before creating the OAuth client.
246
+
247
+
Audience:
248
+
249
+
- Use **External** when the Google account authorizing the YouTube channel may be outside your Google Cloud Organization.
250
+
- Use **Internal** only when every authorizing account is in the same Google Cloud Organization as the project.
251
+
- If you see `org_internal` during authorization, the OAuth app is limited to organization users. Change the audience to External or authorize with an account inside that organization.
252
+
253
+
Publishing status:
254
+
255
+
-**Testing** is fine for initial setup. Add the streaming Google account as a test user before authorizing.
256
+
- Testing-mode authorizations for non-basic scopes can expire after seven days, including refresh tokens. For unattended deployments, move the app to **In production** and complete any required Google verification.
257
+
- In production, users may see an unverified-app warning until Google verifies the app and requested scopes.
258
+
259
+
Data access / scopes:
260
+
261
+
- Add `https://www.googleapis.com/auth/youtube`.
262
+
- This scope is broad, but it is the scope this project uses to manage YouTube Live broadcasts and streams.
263
+
- Avoid adding extra scopes unless the code actually needs them; additional sensitive or restricted scopes can increase verification requirements.
264
+
265
+
Branding:
266
+
267
+
- Use an app name that identifies the deployment, such as `YouTube AutoEncoder`.
268
+
- Provide a monitored support email.
269
+
- Add privacy policy, terms, and authorized domain information if Google requires them for your app state.
270
+
271
+
### 4. Create the OAuth Client
272
+
273
+
1. Open **Google Auth Platform > Clients**.
274
+
2. Click **Create client**.
275
+
3. Choose **TVs and Limited Input devices** where available. This matches the device-code flow used by `youtube-autoencoder-api authorize`.
276
+
4. Name the client, for example `YouTube AutoEncoder`.
277
+
5. Create the client and download the JSON credentials.
278
+
279
+
If the console only offers a generic installed-app flow in your environment, use the device or installed/native option intended for command-line or limited-input devices. If authorization later fails with `invalid_client`, create a new client with the explicit **TVs and Limited Input devices** application type.
280
+
281
+
### 5. Install the OAuth Client JSON
282
+
283
+
Copy the downloaded JSON to the service user's config directory:
The file contains OAuth client credentials. Do not commit it, paste it into issue trackers, or store it in a world-readable location.
296
+
297
+
### 6. Authorize the Encoder
225
298
226
299
```bash
227
300
youtube-autoencoder-api authorize
228
301
```
229
302
230
-
Open the displayed device-flow URL, enter the code, and approve access for the YouTube channel account. The refresh token is stored in:
303
+
The command prints a verification URL and user code. Open the URL on any browser-capable device, enter the code, and approve access with the Google account that owns or manages the target YouTube channel.
304
+
305
+
After approval, the helper stores the OAuth token cache at:
Keep this file private. It contains the refresh token used for unattended operation.
318
+
319
+
### 7. Validate the YouTube API Setup
320
+
321
+
If you already have an OBS-compatible `service.json` with a YouTube stream key:
322
+
323
+
```bash
324
+
youtube-autoencoder-api status
325
+
```
326
+
327
+
For a fresh setup where the reusable YouTube stream should be created automatically, make sure the service user can write the configured OBS service file and set:
328
+
329
+
```text
330
+
YTA_YOUTUBE_CREATE_STREAM=true
331
+
```
332
+
333
+
Then run an API-managed visible test after the rest of the encoder config is in place:
This validates OAuth, the reusable stream, broadcast creation, stream binding, ingest detection, transition to `testing`, transition to `live`, and broadcast completion.
340
+
341
+
### Common Authorization Problems
342
+
343
+
| Symptom | Likely cause | Fix |
344
+
| --- | --- | --- |
345
+
|`org_internal`| OAuth app audience is Internal and the authorizing account is outside the project's Google Cloud Organization. | Change the app audience to External, or authorize with an account inside the organization. |
346
+
|`invalid_client`| OAuth client type does not support the device-code flow. | Create a client for TVs and Limited Input devices, then replace `google-oauth-client.json`. |
347
+
|`authorization_pending`| The browser approval has not completed yet. | Finish the device-code flow; the CLI will keep polling until the code expires. |
348
+
|`slow_down`| Polling is too frequent. | The helper backs off automatically. |
349
+
| Token works briefly then expires | App is still in Testing mode. | Add the correct test user for setup, then move the app to In production for unattended use and complete required verification. |
350
+
| API calls fail despite valid OAuth | The account does not own/manage the YouTube channel, live streaming is not enabled, or quota/policy blocks the operation. | Reauthorize with the right channel account, enable live streaming, and check project quota and YouTube Studio restrictions. |
- Expanded the README into an executive summary covering architecture, runtime process flow, operational commands, recovery behavior, and caveats.
298
-
- Added a standalone changelog so the README can show only the newest entry.
411
+
- Added Google Cloud, YouTube Data API, Google Auth Platform, OAuth client, device-code authorization, validation, and common-error instructions for fresh deployments.
0 commit comments