Getting started / Set up YouTube OAuth client ID and secret

A guide on how to add YouTube Data API v3 to a Google Cloud Platform project and generate OAuth credentials to use in WordPress plugin YouTubeHub.

1. Create a new project

1.1 Begin by visiting https://console.cloud.google.com.

Step 1 - Google cloud console welcome screen

1.2 After clicking “Select a project“, into the modal window click on “NEW PROJECT” to begin creating your new project.

Step 2 - Create a new project

1.3 Choose a name for your project and click “Create”.

Step 3 - Enter project name

1.4 Wait until the project is created (will take a few seconds) and when done open the newly created project by clicking in “Notifications” area.

Step 4 - Open the project

2. Enable YouTube data API for your project

2.1 After opening the project, scroll down in project Dashboard until you see the “Getting Started” panel. In it, click “Explore and enable APIs“.

Step 5 - Enable YouTube Data API

2.2 In API explore screen, click on “ENABLE APIS AND SERVICES“.

Step 6 - Open APIs screen

2.3 Insert into the search field “YouTube data API“.

Step 7 - Search YouTube Data API

2.4 Click on “YouTube Data API v3” in search results.

Step 8 - Open YouTube Data API

2.5 In API screen, click “Enable” to enable this API for your project.

Step 9 - Enable YouTube Data API

3. Generate OAuth credentials

3.1 In left-side menu of your API click on “Credentials“.

Step 10 - Open Credentials screen

3.2 Click “CREATE CREDENTIALS” and into the menu that opens click on “OAuth client ID“.

Step 11 - Open OAuth credentials screen

3.3 In screen for creating OAuth client ID you will notice that everything is frozen and you are required to configure consent screen. Click on “Configure consent screen“.

Step 12 - Open configure consent screen

3.4 In Consent screen configuration enter a name for your application in field “Application name” and save the settings.

Step 13 - Configure consent screen

3.5 After creating the consent screen click on “Credentials” in left menu and click “Create credentials” in page. This will open a menu, choose “OAuth client ID“.

Step 14 - Open OAuth create credentials screen

3.6 Go to your website and copy the return URL for OAuth. The return URL should be the address to your WP admin screen (ie. https://my-website.com/wp-admin).

Step 15 - Copy redirect URL from plugin

3.7 Paste the return URL in field “Authorized redirect URIs” in OAuth client ID screen. You will notice and error that asks you to add the domain to the authorized domain list. Click the link for the authorized domain link.

Step 16 - Edit consent screen to add domain

3.8 This will take you back to the consent screen settings. In field “Authorized domains” add the domain name from your return URL (ie. my0website.com) and save the settings.

Step 17 - Add authorized domain name

3.9 Do step 3.5 again to open the OAuth client ID screen. In field “Authorized redirect URIs” enter the URL you got from your website on step 3.6 and save the settings.

Step 18 - Add return URL to OAuth

3.10 Copy the client ID and client secret and paste them in your website into fields “Client ID” and “Client secret” in plugin Settings page, tab “API & License”.

Step 19 - Copy credentials

Watch video tutorial