Copy the following content into your App.config file.
<add key = 'OAuth2Mode' value = 'APPLICATION' />
<add key = 'OAuth2ClientId' value = '******' />
<add key = 'OAuth2ClientSecret' value = '******' />
<add key = 'OAuth2RefreshToken' value = '******' />
如果您不事先知道要向哪个 Google Ads 账号发出 API 调用,则可以在运行时使用会话中已登录用户的凭据来发现该账号。如需查看示例,请参阅 AuthenticateInAspNetCoreApplication,其中介绍了如何对当前登录的用户进行身份验证,以及如何在运行时获取 OAuth2 凭据。
[[["易于理解","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):2025-02-11。"],[[["Starting with version 19.0.0, the Google Ads API client library for .NET will no longer support .NET 5.0, requiring an upgrade before the end of 2024 for continued functionality."],["This guide explains how to set up OAuth2 for API access using your own credentials, offering two methods: the desktop flow and the web flow."],["You can simplify API calls by linking your Google Ads accounts under a single manager account and using the provided example to generate OAuth2 credentials."],["For interactive applications where the Google Ads account is unknown beforehand, you can discover it at runtime using the credentials of the signed-in user, as demonstrated in the provided example."]]],[]]