# Prepare for a YouTube Connection

Prepare to set up your YouTube channels connection with Data 360.

## Gather Information

The instructions in this article assist you to gather this information that are
required to create a connection to the YouTube connector and to successfully
ingest video content. If you have any of the following information or have already
done any of the steps you may skip them.

- YouTube Channel ID (from YouTube)
- A published YouTube Project for (from Google)
- OAuth Client ID (from Google)
- OAuth Client Secret (from Google)
- A Google API OAuth Refresh Token (from Google)

## Channel Ownership and Access

Only public videos located in the channels you own can be ingested.
If you want to ingest someone else’s videos, co-own their channel or have them
create the connector for you.
If you want to include a private video, change its tag to Public.

## Get Your YouTube Channel ID

This procedure allows you to access your YouTube Channel ID.
If you already have the ID, skip this step.

Before you begin:
Verify you're the owner of the YouTube channel you want to ingest videos from.
If you aren't the owner, ask the owner to perform these steps and send you the ID.

To get your YouTube Channel ID:

1. Go to your [YouTube](https://www.youtube.com/) account and sign in.
2. Select your user avatar in the top right corner.
3. From the dropdown, select **Settings**.
4. From the Settings menu on the left, select **Advanced Settings**.
5. In the Advanced settings screen, find the **Channel ID** field, and select **Copy**.
   Save this information as you will need it later. The ID is similar to: `UCklnwi5PqVorRrIt7UNpmWQ`.

## Get Your Google API OAuth Client ID and Client Secret

### Step 1 - Create a YouTube Project in Google Cloud Console

If you already have a YouTube project, skip to Step 2.
If not, follow the instructions in [Google's](https://cloud.google.com/resource-manager/docs/creating-managing-projects) documentation.
Remember to publish the project to production and proceed to step 2.

### Step 2 - Create YouTube Credentials

1. From your browser, go to the [Google Cloud Console](https://console.cloud.google.com/projectselector2/apis/credentials?supportedpurview=project).
2. Select a YouTube project such as the project you created in Step 1.
3. In the APIs and Services menu, select **Credentials**.
4. Select **Create Credentials**.
5. From the dropdown menu that opens, select **OAuth client ID**.
6. From the Application dropdown, select **Web application**.
7. Fill in the **Name** field with a name for the Client ID.
8. Under Authorized redirect URIs, select **Add URI**.
9. In the URIs field, enter: <https://developers.google.com/oauthplayground>
10. Select **Create**.
11. A popup opens. In the popup, you can see the generated **Client ID** and **Client Secret**.
    Copy the Client ID and Client Secret to a safe location as you will need it later.
    After you close the popup you can retrieve the Client ID and Secret by clicking
    the [Credentials](https://console.cloud.google.com/projectselector2/apis/credentials?supportedpurview=project) menu.
12. Close the popup. Proceed to the next section to get a refresh token.

## Get Your Google API OAuth Refresh Token

In this procedure you will be able to create a refresh token for the YouTube connector.
This action prevents the connector authentication token from expiring.

Before you begin:
Make sure you have your YouTube Client ID and Client Secret.

1. From a browser, go to: [OAuth 2.0 Playground](https://developers.google.com/oauthplayground/).
2. Select **Settings**.
3. Check the **Use your own OAuth credentials** checkbox.
4. Enter the following information
   - OAuth Client ID – Enter the Client ID you copied on Step 2.
   - OAuth Client Secret – Enter the Client Secret you copied on Step 2.
5. Select Close.
6. In the left panel, expand **Step 1 Select & authorize APIs**.
7. Expand **YouTube Data API v3 v3** and select **<https://www.googleapis.com/auth/youtube.force-ssl>**
8. Select **Authorize APIs**.
9. Select your account and select **Allow Access**. You will get an authorization code. **Copy this code**. You need it for the next step.
10. Expand **Step 2 Exchange authorization code for tokens**.
11. In the Authorization Code field, paste the authorization code you copied above.
12. Select **Exchange authorization code for tokens**.
13. Check the **Auto-refresh token before it expires** checkbox. If you don't check this checkbox and your token expires, your connector will fail, and you will have to regenerate the refresh token.
14. Your Refresh token appears in the Refresh token field. Copy this information and save it in a safe location. You will need this later.
15. Continue to the next section: Add labels to YouTube Content.

## Add Tags to YouTube Videos

Add tags to your YouTube videos as described in [YouTube Help](https://support.google.com/youtube/answer/146402?hl=en).
When your YouTube content is uploaded, the tags that you use for the videos are included. You can use these tags to filter which videos are uploaded to Data 360.
Suppose you want to upload only videos on a specific topic. In this case, create a tag for that subject and add it to all applicable videos.
When the connector runs, if you have selected the custom tag as a filter, you can include or exclude all videos that are using the tag.

For example, your YouTube channel contains videos that are for both Enterprise and
Public customers. If you create a custom tag called Enterprise and apply it to your
Enterprise video content, you'll be able to explicitly include or exclude the
Enterprise content by listing the tag in the connector set up. At runtime, the
Enterprise videos tagged with the Enterprise tag will be included or excluded
depending on how you set up the connector.

## Create a List of YouTube Playlists

If you have YouTube playlists, you can use the name of the playlist
to select the videos located in the playlist.
See [YouTube Help](https://support.google.com/youtube/answer/57792?hl=en\&co=GENIE.Platform%3DAndroid) for instructions on managing playlists.
Collect a list of playlists that contain videos you want to ingest.

Next Step:
[Set Up a YouTube Connection](/docs/data/data-cloud-int/guide/c360-a-setup-youtube-connection.md)

## Next Step

- [Set Up a YouTube Connection](/docs/data/data-cloud-int/guide/c360-a-setup-youtube-connection.md)
