Creating a Custom OAuth App
You can use a custom OAuth app to authenticate a service account or a user account. See Using OAuth Authentication for more information.
Create an OAuth App for User Account Authentication
Follow the procedure below to register an app and obtain the OAuthClientId and OAuthClientSecret.
Create a Custom OAuth App: Desktop
- Log into the Google API Console and open a project. Select the API Manager from the main menu.
-
In the user consent flow, click Credentials -> Create Credentials -> OAuth Client Id. Click Other. After creating the app, the OAuthClientId and OAuthClientSecret are displayed.
- Click Library -> YouTube Analytics API -> Enable API.
Create a Custom OAuth App: Web Apps
- Log into the Google API Console and open a project. Select the API Manager from the main menu.
- Click Credentials -> Create Credentials -> OAuth Client Id -> Web Application. In the Authorized Redirect URIs box, enter the URL you want to be used as a trusted redirect URL, where the user will return with the token that verifies that they have granted your app access. After creating the app, the OAuthClientId and OAuthClientSecret are displayed.
- Click Library -> YouTube Analytics API -> Enable API.
Create a Custom OAuth App: Headless Machines
Follow the procedure below to register an app and obtain the OAuth client credentials.
- Log into the Google API Console and open a project. Select the API Manager from the main menu.
- Click Credentials -> Create Credentials -> OAuth Client Id. From the dropdown, select "Desktop app". Name the app and click Create. After creating the app, the OAuthClientId and OAuthClientSecret are displayed.
- Click Library -> YouTube Analytics API -> Enable API.
Create an OAuth App for Service Account Authentication
Follow the steps below to create an OAuth application and generate a private key. You will then authorize the service account.
- Log into the Google API Console and open a project. Select the API Manager from the main menu.
- Click Create Credentials -> Service Account Key.
- In the Service Account menu, select New Service Account or select an existing service account.
- If you are creating a new service account, additionally select one or more roles. You can assign primitive roles at the project level in the IAM and Admin section; other roles enable you to further customize access to Google APIs.
- In the Key Type section, select the P12 key type.
- Create the app to download the key pair. The private key's password is displayed: Set this in OAuthJWTCertPassword.
- In the service accounts section, click Manage Service Accounts and set OAuthJWTIssuer to the email address displayed in the service account Id field.
- Click Library -> YouTube Analytics API -> Enable API.