驗證存取權核准
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
本文說明如何以程式輔助方式向 Access Approval 驗證。您如何驗證存取權核准,取決於您用來存取 API 的介面,以及程式碼執行的環境。
如要進一步瞭解 Google Cloud 驗證,請參閱「驗證方法」。
透過 API 存取
Access Approval 支援程式輔助存取機制。您可以透過下列方式存取 API:
Google Cloud CLI
使用 gcloud CLI 存取存取權核准功能時,您必須使用使用者帳戶登入 gcloud CLI,這樣才能提供 gcloud CLI 指令使用的憑證。
如果貴機構的安全性政策禁止使用者帳戶取得必要權限,您可以使用服務帳戶冒用功能。
詳情請參閱「驗證 gcloud CLI 使用權限」。如要進一步瞭解如何使用 gcloud CLI 搭配存取權核准功能,請參閱 gcloud CLI 參考頁面。
REST
您可以使用 gcloud CLI 憑證或應用程式預設憑證,對 Access Approval API 進行驗證。如要進一步瞭解如何驗證 REST 要求,請參閱「驗證 REST 使用權限」。如要瞭解憑證類型,請參閱 gcloud CLI 憑證和 ADC 憑證。
Access Approval 的存取權控管
完成 Access Approval 驗證後,您必須獲得授權才能存取 Google Cloud 資源。存取權核准功能會使用 Identity and Access Management (IAM) 進行授權。
如要進一步瞭解存取權核准的角色,請參閱「使用 IAM 控管存取權」。如要進一步瞭解身分與存取權管理和授權,請參閱 身分與存取權管理總覽。
後續步驟
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-09-04 (世界標準時間)。
[[["容易理解","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-09-04 (世界標準時間)。"],[[["\u003cp\u003eAccess Approval can be accessed programmatically through the Google Cloud CLI or REST.\u003c/p\u003e\n"],["\u003cp\u003eAuthentication to Access Approval depends on the interface used (gcloud CLI or REST) and the environment in which the code is running.\u003c/p\u003e\n"],["\u003cp\u003eThe gcloud CLI uses user account credentials by default, but supports service account impersonation for stricter security requirements.\u003c/p\u003e\n"],["\u003cp\u003eREST API access can use either gcloud CLI credentials or Application Default Credentials for authentication.\u003c/p\u003e\n"],["\u003cp\u003eAfter authenticating, users must be authorized to access Google Cloud resources via Identity and Access Management (IAM).\u003c/p\u003e\n"]]],[],null,["# Authenticate to Access Approval\n\nThis document describes how to authenticate to Access Approval programmatically. How\nyou authenticate to Access Approval depends on the interface you use to access the API\nand the environment where your code is running.\n\n\nFor more information about Google Cloud authentication, see the\n[Authentication methods](/docs/authentication).\n\nAPI access\n----------\n\n\nAccess Approval supports programmatic access. You can access the API in\nthe following ways:\n\n- [Google Cloud CLI](#gcloud)\n- [REST](#rest)\n\n### Google Cloud CLI\n\n\nWhen you use the [gcloud CLI](/sdk/gcloud/reference/access-approval) to access\nAccess Approval, you\n[log in to the gcloud CLI](/sdk/docs/authorizing) with a user\naccount, which provides the credentials used by the gcloud CLI commands.\n\n\nIf your organization's security policies prevent user accounts from having the required\npermissions, you can use [service account impersonation](#sa-impersonation).\n\nFor more information, see\n[Authenticate for using the gcloud CLI](/docs/authentication/gcloud).\nFor more information about using the gcloud CLI with Access Approval,\nsee [the gcloud CLI reference pages](/sdk/gcloud/reference/access-approval).\n\n\n### REST\n\n\nYou can authenticate to\n[the Access Approval API](/assured-workloads/access-approval/docs/reference/rest)\nby using your gcloud CLI credentials or by using\n[Application Default Credentials](/docs/authentication/application-default-credentials).\nFor more information about authentication for REST requests, see\n[Authenticate for using REST](/docs/authentication/rest).\nFor information about the types of credentials, see\n[gcloud CLI credentials and ADC credentials](/docs/authentication/gcloud#gcloud-credentials).\n\nAccess control for Access Approval\n----------------------------------\n\n\nAfter you authenticate to Access Approval, you must be authorized to access\nGoogle Cloud resources. Access Approval uses\nIdentity and Access Management (IAM) for authorization.\n\n\nFor more information about the roles for Access Approval, see\n[Access control with IAM](/assured-workloads/access-approval/docs/access-control).\nFor more information about IAM and authorization, see\n[IAM overview](/iam/docs/overview).\n\nWhat's next\n-----------\n\n- Learn about [Google Cloud authentication methods](/docs/authentication#auth-decision-tree).\n- See a list of [authentication use cases](/docs/authentication/use-cases)."]]