OAuth Service Account Flow

This guide will walk you through how to setup OAuth2 for API access using your own credentials using server-to-server 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 JSON key file 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 an ads.properties file, add the following:

api.googleads.serviceAccountSecretsPath=PRIVATE_KEY_FILE_PATH
api.googleads.serviceAccountUser=DELEGATE_ACCOUNT