API 密钥与其创建时所在的 Google Cloud 项目相关联。如果您的 API 需要 API 密钥,则您必须向您的 API 用户提供密钥(该密钥源自您在其中创建 Cloud Endpoints 服务的项目),或者让用户在各自的 Google Cloud项目中启用您的 API 并创建 API 密钥。本页面介绍如何授予用户启用 API 所需的权限。
授予访问权限
Endpoints 使用 Identity and Access Management (IAM)Service Consumer 角色,令非Google Cloud 项目成员能够在各自的 Google Cloud项目中启用您的 API。本部分介绍如何使用 Google Cloud 控制台或 Google Cloud CLI 授予访问权限。
Google Cloud 控制台
在 Google Cloud 控制台中,前往项目的 Endpoints > Services 页面。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-03-25。"],[[["API keys are linked to the Google Cloud project where they are created, allowing users to utilize keys from the service's project or enable the API in their own project."],["The Identity and Access Management (IAM) Service Consumer role grants external users the ability to enable the API in their Google Cloud projects."],["Access can be granted to users or Google Groups via the Google Cloud console or the Google Cloud CLI by assigning the Service Consumer role."],["Access can be revoked from users or Google Groups through the Google Cloud console or the Google Cloud CLI by removing the Service Consumer role."],["Revoking access doesn't prevent users who have already enabled the API from making calls, however, logic can be implemented to disable specific API keys."]]],[]]