API 金鑰是一種簡易字串,用於識別Google Cloud 專案的配額、帳單及監控等功能。開發人員會在 Google Cloud 控制台的專案中產生 API 金鑰,然後將該金鑰以查詢參數的形式,嵌入在對 API 發出的每一個呼叫中,或在要求標頭中嵌入。
如果您在 API 設定中指定 API 金鑰需求,API Gateway 會使用該 API 金鑰查詢相關聯的 Google Cloud 專案。除非該 API 金鑰是在您的 Google Cloud 專案中或在已啟用您 API 的其他Google Cloud 專案中產生,否則 API Gateway 會拒絕要求。
如要建立 API 金鑰,或查看 Google Cloud 專案中已可用的 API 金鑰,請前往「API 和服務」>「憑證」頁面。
[[["容易理解","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 keys are simple strings used to identify a Google Cloud project for quota, billing, and monitoring in API Gateway."],["API Gateway requires API keys generated within your Google Cloud project, or projects where your API is enabled, to authorize requests."],["While useful for features like quotas, API keys are vulnerable to man-in-the-middle attacks and should not be the sole form of authentication for sensitive data."],["Enabling API key support for a service requires using the `gcloud services enable MANAGED_SERVICE_NAME` command, specifying the managed service's name."],["For security, API keys should be restricted to specific APIs through the Google Cloud console's **APIs & Services \u003e Credentials** page, ensuring they are not used by unauthorized parties."]]],[]]