Skip to content

API access using own credentials (server to server flow)

Anash P. Oommen edited this page Sep 6, 2018 · 7 revisions

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

Follow the steps for the product you're using to generate a *service account ID and a .JSON file, then come back to this page.

If you're an AdWords user, please note that this flow requires a Google Apps Domain and impersonation.

Step 2 - Setting up the client library using JSON configuration file

Configure the following keys in your App.config / Web.config.

<add key="OAuth2Mode" value="SERVICE_ACCOUNT" />
<add key="OAuth2SecretsJsonPath" value="INSERT_OAUTH2_SECRETS_JSON_FILE_PATH_HERE" />
<!-- If using AdWords, supply the email for impersonation. If using Google Ad Manager, remove this key. -->
<add key="OAuth2PrnEmail" value="INSERT_OAUTH2_USER_EMAIL_HERE" />