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:
Visit the YouTube website and click the “Sign in” button on the upper right corner of the website.
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.
Click the “User” button on the upper right corner of the website and select the “Create a channel” option.
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.
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.
Visit the Advance Account Settings page to view and copy our channel ID.
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.
Visit the Google Cloud Platform website and click the “Sign in” button in the upper right-hand corner of the website.
Sign in with our Google account credentials. After that, we’ll be redirected to the Google Cloud home page.
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.
After providing the name for our project, click the “CREATE” button.
Finally, select the created project.
Enable the YouTube Data API
Click the “Menu” button in the upper left-hand corner. Navigate to “APIs & services” and click the “Enabled APIs & Services” option.
Click the “ENABLE APIS AND SERVICES” button. This redirects us to the API library.
Search “YouTube Data API v3” in the search bar.
Select the “YouTube Data API v3” from the search results. This takes us to the YouTube Data API page.
Click the “ENABLE” button. This redirects us to the YouTube Data API details page.
Set up the consent screen
Select “Credentials” from the “APIs & services” menu.
Now, click the “CREATE CREDENTIALS” button at the top of the menu bar.
After that, select the “OAuth client ID” from the drop-down menu. It redirects us to the OAuth client ID page.
Click the “CONFIGURE CONSENT SCREEN” button. It takes us to the OAuth consent screen page.
Select “External” from the “User Type” option and click the “CREATE” button, which redirects us to the “Edit app registration” page.
Enter the app name, the user support email address, and the developer’s contact information.
Now, click the “SAVE AND CONTINUE” button, which takes us to the “Scopes” page, where we can configure scopes for the app.
On the “Scopes” page, click the “ADD OR REMOVE SCOPES” button.
In the “Update selected scopes” window, search “YouTube,” select the following scopes, and click the “ADD TO TABLE” button:
https://www.googleapis.com/auth/youtubehttps://www.googleapis.com/auth/youtube.readonlyhttps://www.googleapis.com/auth/youtube.force-ssl
After adding scopes, click the “UPDATE” button. The added scopes will appear under the “Your sensitive scopes” heading.
Click the “SAVE AND CONTINUE” button.
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.
In the end, click the “BACK TO DASHBOARD” button, which redirects us to the “OAuth consent screen” dashboard.
Generate OAuth credentials
Select “Credentials” from the “APIs & services” menu.
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.
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.”
{{EDUCATIVE_LIVE_VM_URL}}
{{EDUCATIVE_LIVE_VM_URL}}:3000
Click the “CREATE” button and our “Client ID” and “Client Secret” keys will appear. In a pop-up window,
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.