Creating a Custom OAuth Application
Setting up OAuth authentication requires some advance configuration. Once the user account, service account, or GCP Instance account is configured correctly, it is ready to connect.
User Accounts
This section describes how to register a custom OAuth application and obtain the OAuthClientId and OAuthClientSecret for User Accounts.
Desktop
To register an app and obtain the OAuth client credentials:
- Log into the Google API Console.
- Open a project.
- From the main menu, select the API Manager.
- In the user consent flow, click Credentials > Create Credentials > OAuth Client Id.
- Click Other. The Google API Console creates the custom application and displays the OAuthClientId and OAuthClientSecret.
- Record the OAuthClientId and OAuthClientSecret for later use.
- Click Library > YouTube Analytics API > Enable API.
Web
To register an app and obtain the OAuth client credentials:
- Log into the Google API Console.
- Open a project.
- From the main menu, select the API Manager.
- In the user consent flow, click Credentials > Create Credentials > OAuth Client Id > Web Application.
- In the Authorized Redirect URIs box, enter the URL where you want the user to land after they return with the token that verifies that they have granted access to your application. The Google API Console creates the custom application and displays the OAuthClientId and OAuthClientSecret.
- Record the OAuthClientId and OAuthClientSecret for later use.
- Click Library > YouTube Analytics API > Enable API.
Headless Machines
To register an app and obtain the OAuth client credentials:
- Log into the Google API Console.
- Open a project.
- From the main menu, select the API Manager.
- In the user consent flow, click Credentials > Create Credentials > OAuth Client Id.
- From the dropdown, select "Desktop app". Give the application a name, then click Create. The Google API Console creates the custom application and displays the OAuthClientId and OAuthClientSecret.
- Record the OAuthClientId and OAuthClientSecret for later use.
- Click Library > YouTube Analytics API > Enable API.
Service Accounts
To create an OAuth application, generate a private key, and then authorize the service account:
- Log into the Google API Console.
- Open a project.
- From the main menu, select the API Manager.
- In the user consent flow, click Credentials > Create Credentials > Service Account Key.
- In the Service Account menu, select either New Service Account (if applicable) or an existing service account.
- If this is a new service account, 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 P12.
- Click Create. The Google API Console creates the custom application and displays the key pair and the password for the private key.
- Download the key pair and set the private key's password in OAuthJWTCertPassword.
- In the Service Account menu, click Manage Service Accounts.
- Set OAuthJWTIssuer to the email address displayed in the service account Id field.
- Click Library > YouTube Analytics API > Enable API.
GCP Instance Accounts
When running on a GCP virtual machine, the driver can authenticate using a service account tied to the virtual machine. To use this mode, set AuthScheme to GCPInstanceAccount.