Skip to main content
Skip table of contents

Setting Up a YouTube Project in the Google Developers Console (Production-Ready)

1. Create a New Project


2. Enable the YouTube Data API v3

  • In your project, navigate to:

    CODE
    APIs & Services > Library
  • Search for YouTube Data API v3 and enable it.


3. Obtaining API Credentials

Step 1: Creating Credentials
  • Navigate to:

    CODE
    APIs & Services > Credentials 
  • Click on Create Credentials and select:

    • OAuth 2.0 Client ID – Required for accessing user-specific data like managing YouTube videos or playlists.

Step 2: Configuring the OAuth Consent Screen
  • Click Configure Consent Screen, which will redirect you to the OAuth Consent Screen setup.

  • Select User Type:

    • For Testing: Internal

    • For Production: External (required for public users)

  • Fill in the required fields (indicated with *) and provide the following:

    • App Name

    • Support Email

    • Authorized Domains (must be verified in Google Search Console)

    • Privacy Policy and Terms of Service URLs

    • Developer Contact Information

  • In the Scopes section, add:

    CODE
    https://www.googleapis.com/auth/youtube.readonly https://www.googleapis.com/auth/youtube.force-ssl 
  • For production, you must:

    • Justify the use of each scope.

    • Upload a video demo.

    • Add app screenshots showing usage.

    • Submit the app for verification.

Step 3: Securing Your Credentials
  • Go to the Credentials tab again and click Create Credentials.

  • Choose:

    Application Type: Web Application

    • Name: expertflow

    • Redirect URI:

      • For Testing: https://oauth.pstmn.io/v1/callback

      • For Production: https://yourdomain.com/oauth/callback (use your own secure domain)

  • IMPORTANT: Store your Client ID and Client Secret securely. Never expose them in client-side code.


4. Grant Developer Access in Google Cloud IAM

Navigate to IAM Settings:
  • Go to the Google Cloud Console.

  • Open your project.

  • In the left sidebar:

    IAM & Admin > IAM

Add a Principal (Developer):
  • Click on Grant Access.

  • In the New Principals field, enter the developer’s email address.

Assign a Role:
  • Under Assign Roles, click on Select a role:

    • Recommended:

      • Editor – Full access except managing roles

      • Or role like Cloud Functions Developer, App Engine Developer

Set IAM Conditions (Optional):
  • You may set conditions to restrict by time, resources, etc.

Save Changes:
  • Click Save to grant access.

Alternative (Multiple Developers):
  • Create a Google Group, assign developers to the group, and give role access to the group.


5. Obtain Authorization Code

Use the following link to initiate the OAuth flow in your browser:

CODE
https://accounts.google.com/o/oauth2/auth?   client_id=YOUR_CLIENT_ID   &redirect_uri=https://yourdomain.com/oauth/callback   &response_type=code   &scope=https://www.googleapis.com/auth/youtube.force-ssl   &access_type=offline   &prompt=consent 
Explanation of Parameters:
  • client_id: Your application’s client ID.

  • redirect_uri: Your verified URI (must match one registered in GCP).

  • response_type: code to receive authorization code.

  • scope: YouTube access permission.

  • access_type: offline to receive refresh token.

  • prompt: consent to force re-approval.

Example Redirect:
CODE
https://yourdomain.com/oauth/callback?code=4/0AeanS0YV.......&scope=https://www.googleapis.com//youtube.force-ssl 

6. Exchange Authorization Code for Tokens

Send a POST request using Postman or your backend server:

Token URI:
CODE
POST https://oauth2.googleapis.com/token 
Headers:
CODE
Content-Type: application/x-www-form-urlencoded 
Body:

code=4/0AX4XfWhG7EXAMPLECODE client_id=YOUR_CLIENT_ID client_secret=YOUR_CLIENT_SECRET redirect_uri=https://yourdomain.com/oauth/callback grant_type=authorization_code

Example Response:

{ "access_token": "ya29.a0ARr...", "expires_in": 3600, "refresh_token": "1//0gA8A...", "scope": "https://www.googleapis.com/auth/youtube.force-ssl", "token_type": "Bearer" }


7. Use Tokens to Access YouTube API

  • Use access_token to authenticate your API calls.

  • Store refresh_token securely to obtain new access tokens without user re-consent.


8. Request Quota Increase (Optional)

If your app exceeds the default quota (10,000 units/day):

  • Go to:

    CODE
    IAM & Admin > Quotas 

    Filter for YouTube Data API v3

  • Select the quota field and Request Increase

  • Provide:

    • App description

    • Number of users

    • Daily request estimate

    • Reason for increase


9. Enable Logging and Monitoring

To monitor and audit API usage:

  • Navigate to:

    CODE
    Logging > Logs Explorer 
  • And:

    CODE
    Monitoring > Metrics Explorer

Enable:

  • Cloud Audit Logs

  • Alerts for token failures or unusual traffic


10. Remove Test Users After Verification

  • Go to:

    CODE
    APIs & Services > OAuth Consent Screen > Test Users 
  • Remove any test users once the app is verified and in production.


YouTube Channel Configuration in Expertflow Unified Admin

for integration with Expertflow follow this link.

https://expertflow-docs.atlassian.net/wiki/spaces/CX/pages/679117567/YouTube+Integration-not+to+be+published#YouTube-Channel-Configuration-in-Expertflow-Unified-Admin

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.