[Live Demo] Building a Google Ads API Web App - Part 4: Generating Refresh Tokens

Опубликовано: 14 Март 2026
на канале: Google Ads Developers
13,283
68

This is the fourth part of an 8-episode series, in which we’ll take a deep dive into developing web apps with the Google Ads API, with a focus on the OAuth flow, by building a multi-tenant app entirely from scratch.

This episode will illustrate the process of generating refresh tokens for Google Ads API access in the context of a web server using Python Flask. In addition, we’ll demonstrate how to troubleshoot common OAuth related issues, such as redirect_uri_mismatch and changes in SCOPE.

Resources:
Google Ads API documentation: https://developers.google.com/google-...
Google Ads API OAuth documentation: https://developers.google.com/google-...
Google Ads API Auth Video Series:    • Authentication & Authorization Series  
Flask quickstart documentation: https://flask.palletsprojects.com/en/...
Python client library for the Google Ads API: https://github.com/googleads/google-a...
Python generate_user_credentials example: https://github.com/googleads/google-a...
Anti-forgery state token: https://developers.google.com/identit...
Google Cloud console: https://console.cloud.google.com
About app verification: https://support.google.com/cloud/answ...

Chapters:
00:00 Intro
01:25 Getting Started with Python Flask
01:45 OAuth flow Overview
03:03 Generating the Authorization URL
04:09 Google Ads API SCOPE
07:40 Creating the Client Secrets Path
10:15 Handling the OAuth2 Callback
13:44 Integrating with the Client
15:39 Fixing redirect_uri_mismatch
16:58 Explaining App Verification Warning
18:05 Handling Scope Change Errors
19:24 Final OAuth Flow Demo