> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corsair.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Credentials

> Step-by-step instructions for obtaining Google OAuth 2.0 credentials for the YouTube Data API (same Google Cloud flow as Gmail and other Google plugins).

This guide walks you through obtaining all required credentials for the YouTube plugin.

## Authentication Method

The YouTube plugin uses OAuth 2.0 authentication exclusively.

* **[`oauth_2`](/concepts/oauth)** (default) — OAuth 2.0 for the **YouTube Data API v3**

The steps match other Google integrations (Gmail, Google Calendar, Drive, and Sheets): you create an OAuth client in **Google Cloud**, enable the **YouTube Data API v3**, add redirect URIs, then store `client_id` and `client_secret` and run the Corsair auth flow. You can use the **same Google Cloud project** as your other Google OAuth apps if you add the YouTube API and the right scopes to the consent screen.

## OAuth 2.0 Setup

### Step 1: Create or select a Google Cloud project

1. Go to [Google Cloud Console](https://console.cloud.google.com/).
2. Create a new project or select an existing one (the same project you use for Gmail/Drive/Calendar is fine if you prefer one OAuth app for all Google services).

### Step 2: Enable YouTube Data API v3

1. Open **APIs & Services** → **Library**.
2. Search for **YouTube Data API v3**.
3. Open it and click **Enable**.

### Step 3: Configure the OAuth consent screen

1. Go to **APIs & Services** → **OAuth consent screen**.
2. Choose **External** (or **Internal** for Workspace-only apps) and complete the required fields.
3. On **Scopes**, add the YouTube scopes your app needs. Examples (add only what you use):
   * `https://www.googleapis.com/auth/youtube.readonly` — read-only access to channel and video metadata the API allows.
   * `https://www.googleapis.com/auth/youtube` — manage your YouTube account (upload, edit, etc.; broad).
   * `https://www.googleapis.com/auth/youtube.force-ssl` — account access over HTTPS (often used with full channel management).

Refer to [YouTube Data API authorization scopes](https://developers.google.com/youtube/v3/guides/auth/installed-apps#identify-access-scopes) for the full list.

### Step 4: Create OAuth 2.0 credentials

1. Go to **APIs & Services** → **Credentials**.
2. Click **Create credentials** → **OAuth client ID**.
3. Choose **Web application** (or the client type Corsair expects for your deployment).
4. Under **Authorized redirect URIs**, add the callback URL your app uses for YouTube OAuth (the same pattern as Gmail or Calendar — e.g. `https://yourapp.com/auth/youtube/callback` or whatever you configured in Corsair).
5. Create the client and copy the **Client ID** and **Client secret**.

**Storing credentials and authorizing:**

```bash theme={null}
pnpm corsair setup --plugin=youtube client_id=your-client-id client_secret=your-client-secret
pnpm corsair auth --plugin=youtube
```

Open the authorization URL from the CLI, sign in with Google, and approve access. Tokens are stored for Corsair to use.

Verify:

```bash theme={null}
pnpm corsair auth --plugin=youtube --credentials
```

## Required Credentials Summary

| Credential              | Required for                 | Where to find                                                 |
| ----------------------- | ---------------------------- | ------------------------------------------------------------- |
| Client ID               | [`oauth_2`](/concepts/oauth) | Google Cloud Console → APIs & Services → Credentials          |
| Client secret           | [`oauth_2`](/concepts/oauth) | Same page                                                     |
| Access / refresh tokens | After OAuth                  | Issued when you complete `pnpm corsair auth --plugin=youtube` |

For general information about how Corsair handles authentication, see [Authentication](/concepts/auth). For Google OAuth setup shared across products, you can also align with [Gmail Get Credentials](/plugins/gmail/get-credentials) and [Google Calendar Get Credentials](/plugins/googlecalendar/get-credentials) — the Cloud project and OAuth client pattern is the same; only the enabled API and scopes differ.
