此示例提示您访问一个网址,在该网址中您需要允许
使用 OAuth2 凭据登录您的 Google Ads 账号。
Paste this URL in your browser:
https://accounts.google.com/o/oauth2/v2/auth?response_type=code&access_type=offline&client_id=...
在无痕浏览器会话或无痕式窗口中访问该网址。
使用您访问 Google Ads 时所用的 Google 账号进行登录。点击
在 OAuth2 同意屏幕上继续。
随后,您将转到一个页面,其中显示一条消息,说明
授权成功。
已提取您的刷新令牌。请查看控制台输出以了解更多信息
操作说明。
返回您运行示例的控制台。该示例应
已完成并显示您的刷新令牌和一些说明
以及配置客户端库所需的属性:
Your refresh token is: 1/Yw**********
Copy the text below into a file named "google_ads_php.ini" in your home directory, and replace "INSERT_DEVELOPER_TOKEN_HERE" with your developer token:
[GOOGLE_ADS]
developerToken = "INSERT_DEVELOPER_TOKEN_HERE"
[OAUTH2]
Copy the following lines to your 'google_ads_php.ini' file:
clientId = "***********************apps.googleusercontent.com"
clientSecret = "****"
refreshToken = "****"
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2024-10-09。"],[[["This guide explains how to set up OAuth2 for Google Ads API access using your own credentials through either a desktop or web flow."],["You'll need to create OAuth2 credentials by configuring a Google API Console project and noting your client ID and secret."],["The setup involves running a client library example that guides you through an authorization process using your Google account."],["Upon successful authorization, you'll receive a refresh token and instructions to configure your client library with the necessary properties."]]],[]]