有兴趣分享您对 Google Ads API 的反馈吗?
注册即可获邀参与用户调研!
OAuth 服务账号流程
本指南将详细介绍如何使用服务账号使用自己的凭据设置 OAuth2 以访问 API。除非您撤消或删除 OAuth2 凭据,否则只需执行一次这些步骤。
创建 OAuth2 凭据
按照链接中的说明生成服务账号 ID 和 *.JSON 文件,然后返回此页面。
设置客户端库
在配置中设置私钥 JSON 文件路径和委托账号 ID。如果您使用的是 ads.properties
文件,请添加以下内容:
api.googleads.serviceAccountSecretsPath=PRIVATE_KEY_FILE_PATH
api.googleads.serviceAccountUser=DELEGATE_ACCOUNT
如需了解详情,请参阅配置指南。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-02-26。
[null,null,["最后更新时间 (UTC):2025-02-26。"],[[["This guide explains how to set up OAuth2 for API access using service accounts with your own credentials."],["The setup process involves generating a service account ID and a JSON file, and then configuring your client library with the necessary credentials."],["This setup needs to be done only once and requires a Google Workspace domain with domain-wide delegation access granted to the service account."]]],[]]