This guide walks you through how to set up OAuth2 for API access with your own credentials using the service account flow. These steps only need to be done once, unless you revoke or delete your OAuth2 credentials.
Step 1: Creating OAuth2 credentials
Generate a service (delegate) account ID and a
by following the linked instructions, then come back to this page.
Step 2: Setting up the client library
Set the private key JSON file path and delegate account ID in your
configuration. If you're using a
googleads.properties file, add the following:
If you're using environment variables, add the following to your Bash configuration or environment:
export GOOGLE_ADS_JSON_KEY_FILE_PATH=PRIVATE_KEY_FILE_PATH export GOOGLE_ADS_IMPERSONATED_EMAIL=DELEGATE_ACCOUNT_ID