How to Get a YouTube Client ID and Client Secret

In short

A YouTube Client ID and Client Secret are OAuth 2.0 credentials you create for free in Google Cloud. To get them: create a Google Cloud project, enable the YouTube Data API v3, create an OAuth client of type Web application, fill in the consent screen, add your redirect URI, then copy the Client ID and Client Secret. Publish the app so access doesn’t expire after 7 days.

Prefer a plain-text walkthrough? See how to get a YouTube API Client ID and Secret. Not sure whether you need OAuth or an API key? Read YouTube API key vs. OAuth: which one do you need? When you’re done, head to the YouTube video importer.

OAuth is the recommended way to connect Video Hub to YouTube. It lets you import any public video plus your own playlists and unlisted videos, with a smoother, more capable connection than a plain API key — once connected, the API key isn’t needed at all. This guide walks you through creating an OAuth Client ID and Client Secret in the Google Cloud Console and adding them to Video Hub.

What is a YouTube Client ID and Client Secret?

A YouTube Client ID and Client Secret are OAuth 2.0 credentials issued by Google Cloud. They let your WordPress site authenticate with the YouTube Data API v3 so it can read channels, playlists and videos — including your own unlisted videos and private playlists. Follow the steps below to create them.

1. Create a Google Cloud project

Sign in to the Google Cloud Console. This is your starting point. Google Cloud console welcome screen Click the project selector at the top of the page, then click New project. Google Cloud Select a resource dialog with the New project button Give the project a name and click Create. Google Cloud New Project form with name and organization Once it’s created, open the project. You’ll land on the APIs & Services dashboard. Google Cloud APIs and Services dashboard for the new project

2. Enable the YouTube Data API v3

Open the API Library, search for “YouTube Data API v3”, and click the result. Searching the Google Cloud API Library for YouTube Data API v3 Click Enable. The API now shows as enabled for your project. YouTube Data API v3 enabled in Google Cloud

3. Create an OAuth client

In the left menu, open Credentials. Google Cloud Credentials screen with Create credentials Click Create credentials and choose OAuth client ID. Create credentials menu with the OAuth client ID option Set Application type to Web application and give the client a name (for example, “Video Hub”). Don’t click Create just yet — you’ll add your redirect URI in step 5. Create OAuth client ID form set to Web application

4. Set up the consent screen

Under Branding, fill in the details users see when they grant access: your App name (e.g. Video Hub), a user support email, and your site’s home page, privacy policy and terms links. These appear on the OAuth consent screen. Google Auth Platform Branding consent screen with Video Hub app details

5. Add your site’s redirect URI

Video Hub gives you the exact redirect URI to use. In WordPress, open Videos → Settings, go to the API & License tab, and copy the redirect URI shown in the YouTube OAuth credentials section. Video Hub API and License tab showing the OAuth redirect URI to copy Back in Google, paste it under Authorized redirect URIs on your OAuth client, then save. Use the Copy button next to the URI in Video Hub so no character is lost — a mismatch causes Google’s redirect_uri_mismatch error.

6. Copy your credentials into Video Hub

Open your OAuth client to see its Client ID and Client secret. Copy them now — Google no longer lets you view a secret again after it’s created. OAuth client showing the Client ID and Client secret to copy Paste the Client ID and Client secret into the API & License tab in Video Hub, click Save credentials, then Connect YouTube account and grant access. That’s it — Video Hub is now connected to YouTube via OAuth.

7. Publish the app and test the connection

In Google Cloud, open Google Auth Platform → Audience and click Publish app. While the app stays in Testing mode, Google expires the authorization after 7 days and imports stop until you reconnect. When you connect, Google may show an “app isn’t verified” screen; since you are the only user of the app, choose Advanced and continue. Back in Video Hub, click Test connection in the side panel of the API & License tab. It checks the OAuth connection (1 unit of quota) and shows the name of the connected channel. If Google ever rejects the authorization, a notice with a Reconnect YouTube account button appears in your admin. See API & License settings for everything on that tab.

Frequently asked questions

Is the YouTube Data API free?

Yes. Every Google Cloud project gets 10,000 units of YouTube Data API quota per day at no cost. Reading a channel or playlist costs only a few units per page of up to 50 videos (a search costs 100 units), so a typical WordPress site never pays anything. Video Hub shows an estimate of the quota used each day, and you can ask Google for more quota if you need it.

Should I choose Web application or Desktop app?

Web application. Your WordPress site connects from a web server and needs an authorized redirect URI, which only Web application clients have.

Why do I get a redirect_uri_mismatch error?

The redirect URI saved on the OAuth client doesn’t match the one your site sends — often a missing https, www or trailing slash. Copy the URI from Video Hub with the Copy button and paste it again under Authorized redirect URIs.

Why does the connection stop working after 7 days?

The app is still in Testing mode. Publish it under Audience, then reconnect your YouTube account once.

Do I also need an API key?

No. Once your YouTube account is connected through OAuth, the API key isn’t needed; it is only a fallback for sites that can’t use OAuth.

Connected? Start importing

Turn a channel or playlist into real WordPress posts — automatically. See the YouTube video importer.

Start importing in minutes

Bring your YouTube content into WordPress and let it update itself. Includes automatic updates and support.