設定應用程式預設憑證
您為 Cloud 用戶端程式庫、Google API 用戶端程式庫,以及 REST 和 RPC API 設定應用程式預設憑證 (ADC) 的方式,取決於程式碼的執行環境。
如要瞭解 ADC 尋找憑證的位置和順序,請參閱「應用程式預設憑證的運作方式」。
如果您使用 API 金鑰,就不必設定 ADC。詳情請參閱「使用 API 金鑰存取 API」。
向 ADC 提供憑證
選取程式碼的執行環境:
後續步驟
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-08 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-08-08 (世界標準時間)。"],[[["Application Default Credentials (ADC) setup varies depending on the environment where your code is executed."],["ADC is used by Cloud Client Libraries, Google API Client Libraries, and REST and RPC APIs, but API keys do not require ADC setup."],["ADC setup instructions are provided for local development, resources with attached service accounts, containerized environments, on-premises or other cloud providers, and cloud-based development environments."],["You can review documentation to better understand the order in which ADC finds credentials."],["You can find further documentation on authenticating using cloud client libraries, REST, and other authentication methods."]]],[]]