Interested in sharing your feedback about the Google Ads API?
Sign up to be invited to participate in user research!
OAuth Service Account Flow
This guide will walk you through how to setup OAuth2 for API access using your
own credentials using service accounts.
These steps only need to be done once, unless you revoke or delete your OAuth2
credentials.
Create OAuth2 credentials
Generate a service account ID and a *.JSON
file by
following the linked instructions, then come back to this page.
Set up client library with JSON file
Configure the following keys in your App.config / Web.config
. See the
configuration guide for additional
details.
<add key="OAuth2Mode" value="SERVICE_ACCOUNT" />
<add key="OAuth2SecretsJsonPath" value="INSERT_OAUTH2_SECRETS_JSON_FILE_PATH_HERE" />
<!-- Supply the email address of the user to impersonate. -->
<add key="OAuth2PrnEmail" value="INSERT_OAUTH2_USER_EMAIL_HERE" />
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-03-11 UTC.
[null,null,["Last updated 2025-03-11 UTC."],[[["The Google Ads API client library for .NET will no longer support .NET 5.0 starting with version 19.0.0, and upgrading before the end of 2024 is recommended."],["This guide explains how to set up OAuth2 for API access using service accounts, requiring a Google Workspace domain and domain-wide delegation access granted to the service account."],["Users need to generate a service account ID and JSON file before proceeding with client library configuration."],["Configuration involves setting keys in `App.config` or `Web.config`, including OAuth2Mode, OAuth2SecretsJsonPath, and OAuth2PrnEmail."]]],[]]