API 金鑰與建立金鑰時所屬的 Google Cloud 專案相關聯。如果您的 API 需要 API 金鑰,您就必須提供 API 使用者 Cloud Endpoints 服務建立時所屬專案中的金鑰,或是讓 API 使用者能夠在自己的專案中啟用您的 API 及建立 API 金鑰。 Google Cloud本頁說明如何授權使用者啟用您的 API。
授予存取權
Endpoints 會使用 Identity & Access Management (IAM)服務消費者角色,允許您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"]],["上次更新時間:2025-06-09 (世界標準時間)。"],[[["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."]]],[]]