设置应用默认凭据
您如何设置应用默认凭证 (ADC) 以供 Cloud 客户端库、Google API 客户端库以及 REST 和 RPC API 使用取决于代码运行的环境。
如需了解 ADC 查找凭证的位置和顺序,请参阅应用默认凭证的工作原理。
如果您使用的是 API 密钥,就无需设置 ADC。如需了解详情,请参阅使用 API 密钥访问 API。
向 ADC 提供凭据
选择运行代码的环境:
后续步骤
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-08。
[[["易于理解","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-08-08。"],[[["Application Default Credentials (ADC) setup varies depending on the environment where your code is executed."],["ADC is used by Cloud Client Libraries, Google API Client Libraries, and REST and RPC APIs, but API keys do not require ADC setup."],["ADC setup instructions are provided for local development, resources with attached service accounts, containerized environments, on-premises or other cloud providers, and cloud-based development environments."],["You can review documentation to better understand the order in which ADC finds credentials."],["You can find further documentation on authenticating using cloud client libraries, REST, and other authentication methods."]]],[]]