Setting Up the Credentials

Learn how to create a YouTube account and set up a project on the Google Cloud Platform to start using theYouTube Data API.

In this lesson, we’ll learn how to sign in to a YouTube profile using our Google account. Then, after setting up our YouTube account, we’ll create a project on the Google Cloud Platform (GCP). We’ll also explore how we can enable the YouTube Data API service. Finally, we’ll learn how to create OAuth credentials for the YouTube Data API.

Set up a YouTube profile

We need a Google account to set up a YouTube profile. After creating our Google account, do the following to log in to our YouTube profile:

  1. Visit the YouTube website and click the “Sign in” button on the upper right corner of the website.

  2. Sign in to the account by using our Google account credentials. After we’ve signed in, we’ll be redirected to the YouTube home page.

Look at the following slides to better understand the process:

Create a channel

Now, it’s time for us to create a channel that we can use in the upcoming lessons.

  1. Click the “User” button on the upper right corner of the website and select the “Create a channel” option.

  2. After that, a window will pop up with two fields: “Name” and “Handle.” In the “Name” field, write a name for your channel. A handle is a username that appears at the end of the URL to uniquely and easily identify your channel. Write a handle too.

  3. After filling in our details, click the “Create channel” button. We’ll soon be routed to the channel dashboard.

Find the channel ID

In this section, we’ll copy our channel ID for use in the upcoming lessons.

  1. Visit the Advance Account Settings page to view and copy our channel ID.

Press + to interact
Copy the channel ID
Copy the channel ID
  1. After copying the channel ID, click the “Edit” button and save the CHANNEL_ID to be used in upcoming lessons.

Set up a project

Now that we’ve completed the YouTube setup process, it’s time to set up our credentials on the Google Cloud Platform.

  1. Visit the Google Cloud Platform website and click the “Sign in” button in the upper right-hand corner of the website.

  2. Sign in with our Google account credentials. After that, we’ll be redirected to the Google Cloud home page.

  3. Click the “Menu” button in the upper left-hand corner to open the navigation bar. Click the “IAM & Admin” option from the navigation bar and select the “Create a Project” option. It redirects us to the “New Project” page.

  4. After providing the name for our project, click the “CREATE” button.

  5. Finally, select the created project.

Enable the YouTube Data API

  1. Click the “Menu” button in the upper left-hand corner. Navigate to “APIs & services” and click the “Enabled APIs & Services” option.

  2. Click the “ENABLE APIS AND SERVICES” button. This redirects us to the API library.

  3. Search “YouTube Data API v3” in the search bar.

  4. Select the “YouTube Data API v3” from the search results. This takes us to the YouTube Data API page.

  5. Click the “ENABLE” button. This redirects us to the YouTube Data API details page.

Set up the consent screen

  1. Select “Credentials” from the “APIs & services” menu.

  2. Now, click the “CREATE CREDENTIALS” button at the top of the menu bar.

  3. After that, select the “OAuth client ID” from the drop-down menu. It redirects us to the OAuth client ID page.

  4. Click the “CONFIGURE CONSENT SCREEN” button. It takes us to the OAuth consent screen page.

  5. Select “External” from the “User Type” option and click the “CREATE” button, which redirects us to the “Edit app registration” page.

  6. Enter the app name, the user support email address, and the developer’s contact information.

  7. Now, click the “SAVE AND CONTINUE” button, which takes us to the “Scopes” page, where we can configure scopes for the app.

  8. On the “Scopes” page, click the “ADD OR REMOVE SCOPES” button.

  9. In the “Update selected scopes” window, search “YouTube,” select the following scopes, and click the “ADD TO TABLE” button:

Press + to interact
https://www.googleapis.com/auth/youtube
https://www.googleapis.com/auth/youtube.readonly
https://www.googleapis.com/auth/youtube.force-ssl
  1. After adding scopes, click the “UPDATE” button. The added scopes will appear under the “Your sensitive scopes” heading.

  2. Click the “SAVE AND CONTINUE” button.

  3. Keep the default settings for “Test users” because we don’t need to add the current user as a test user. If you want to test the applications presented in this course using a different account, you can do so by adding it as a test user by clicking the “ADD USERS” button. Click the “SAVE AND CONTINUE” button now. The summary for the OAuth consent screen will appear.

  4. In the end, click the “BACK TO DASHBOARD” button, which redirects us to the “OAuth consent screen” dashboard.

Generate OAuth credentials

  1. Select “Credentials” from the “APIs & services” menu.

  2. On the Credentials page, Click the “CREATE CREDENTIALS” button and pick “OAuth client ID” from the drop-down menu. It redirects us to the “Create OAuth client ID” page.

  3. Select “Web application” from the “Application type” page drop-down menu and give the application a name. Enter both the URLs given in the widget below for “Authorized JavaScript origins” and “Authorized redirect URIs.”

Press + to interact
{{EDUCATIVE_LIVE_VM_URL}}
Press + to interact
{{EDUCATIVE_LIVE_VM_URL}}:3000
  1. Click the “CREATE” button and our “Client ID” and “Client Secret” keys will appear. In a pop-up window,

  2. Copy the “Client ID” for later use in the application. The “Client Secret” isn’t required in this course because it’s only required for server-side operations.

Click the “Edit” button in the widget below and paste the “Client ID” we copied in the previous lesson into the text field. Then, press the “Save” button.