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-16 (世界標準時間)。"],[[["API access is granted by assigning the **Service Consumer** role from Identity and Access Management (IAM) to users or Google Groups, allowing them to enable the API in their own Google Cloud projects."],["The Google Cloud console or the gcloud command-line tool can be used to add a user or group to the **Service Consumer** role, which then allows them to access an API."],["Access to an API can be revoked by removing the **Service Consumer** role from a user or group using either the Google Cloud console or gcloud commands, but it does not stop users who have already enabled the API from calling it."],["Once access is granted, users should be informed and directed on how to enable the API in their Google Cloud projects."],["API Keys are linked to a specific Google cloud project, where the API was created, and can be shared for API access, or users can create their own in their respective projects."]]],[]]