Skip to content

API access on behalf of your clients (web flow)

Josh Radcliff edited this page Mar 10, 2023 · 4 revisions

This guide will walk you through how to setup OAuth2 for API access on behalf of your clients using web flow.

Step 1 - Creating OAuth2 credentials

Follow the steps for the product you're using to generate a client ID and secret, then come back to this page.

Step 2 - Setting up the client library

If you authorizing on behalf of multiple users then you need to build OAuth2 sign-in flow into your application as part of adding OAuth2 support for your application. This involves three steps:

  1. Implement an AbstractAuthorizationCodeServlet

    See the authorization code flow here for more details.

  2. Register the servlet's URL as a valid OAuth2 callback URL in the Developer Console.

  3. Configure your AdsSession object to use the OAuth2 Credential.

You can refer to the advanced OAuth example for the product you're using for a full example: