Technical reference
SecretRef 認證資訊介面
此頁面定義標準的 SecretRef 認證資訊介面:哪些認證資訊欄位可接受 SecretRef(由環境變數/檔案/執行命令提供的參照),而非原始密鑰值。
範圍:
- 範圍內:嚴格限於由使用者提供、且 OpenClaw 不會建立或輪替的認證資訊。
- 範圍外:執行階段建立或輪替的認證資訊、OAuth 重新整理資料,以及類似工作階段的成品。
以下清單由來源目標登錄檔產生,並在 CI 中對照 docs/reference/secretref-user-supplied-credentials-matrix.json 檢查;請勿手動編輯項目。
支援的認證資訊
openclaw.json 目標(secrets configure + secrets apply + secrets audit)
models.providers.*.apiKeymodels.providers.*.headers.*models.providers.*.request.auth.tokenmodels.providers.*.request.auth.valuemodels.providers.*.request.headers.*models.providers.*.request.proxy.tls.camodels.providers.*.request.proxy.tls.certmodels.providers.*.request.proxy.tls.keymodels.providers.*.request.proxy.tls.passphrasemodels.providers.*.request.tls.camodels.providers.*.request.tls.certmodels.providers.*.request.tls.keymodels.providers.*.request.tls.passphraseskills.entries.*.apiKeymemory.search.remote.apiKeyagents.entries.*.tts.providers.*.apiKeyagents.entries.*.memory.search.remote.apiKeytalk.providers.*.apiKeytalk.realtime.providers.*.apiKeytts.providers.*.apiKeyplugins.entries.acpx.config.mcpServers.*.env.*plugins.entries.brave.config.webSearch.apiKeyplugins.entries.codex.config.appServer.authTokenplugins.entries.codex.config.appServer.headers.*plugins.entries.exa.config.webSearch.apiKeyplugins.entries.firecrawl.config.webFetch.apiKeyplugins.entries.google-meet.config.realtime.providers.*.apiKeyplugins.entries.google.config.webSearch.apiKeyplugins.entries.xai.config.webSearch.apiKeyplugins.entries.moonshot.config.webSearch.apiKeyplugins.entries.perplexity.config.webSearch.apiKeyplugins.entries.firecrawl.config.webSearch.apiKeyplugins.entries.minimax.config.webSearch.apiKeyplugins.entries.tavily.config.webSearch.apiKeyplugins.entries.parallel.config.webSearch.apiKeyplugins.entries.voice-call.config.realtime.providers.*.apiKeyplugins.entries.voice-call.config.streaming.providers.*.apiKeyplugins.entries.voice-call.config.tts.providers.*.apiKeyplugins.entries.voice-call.config.twilio.authTokenplugins.entries.webhooks.config.routes.*.secretgateway.auth.passwordgateway.auth.tokengateway.remote.tokengateway.remote.passwordcron.webhookTokenchannels.telegram.botTokenchannels.telegram.webhookSecretchannels.telegram.accounts.*.botTokenchannels.telegram.accounts.*.webhookSecretchannels.slack.botTokenchannels.slack.appTokenchannels.slack.relay.authTokenchannels.slack.userTokenchannels.slack.signingSecretchannels.slack.accounts.*.botTokenchannels.slack.accounts.*.appTokenchannels.slack.accounts.*.relay.authTokenchannels.slack.accounts.*.userTokenchannels.slack.accounts.*.signingSecretchannels.sms.authTokenchannels.sms.accounts.*.authTokenchannels.clickclack.tokenchannels.clickclack.accounts.*.tokenchannels.discord.tokenchannels.discord.pluralkit.tokenchannels.discord.voice.tts.providers.*.apiKeychannels.discord.accounts.*.tokenchannels.discord.accounts.*.pluralkit.tokenchannels.discord.accounts.*.voice.tts.providers.*.apiKeychannels.irc.passwordchannels.irc.nickserv.passwordchannels.irc.accounts.*.passwordchannels.irc.accounts.*.nickserv.passwordchannels.feishu.appSecretchannels.feishu.encryptKeychannels.feishu.verificationTokenchannels.feishu.accounts.*.appSecretchannels.feishu.accounts.*.encryptKeychannels.feishu.accounts.*.verificationTokenchannels.qqbot.clientSecretchannels.qqbot.accounts.*.clientSecretchannels.msteams.appPasswordchannels.mattermost.botTokenchannels.mattermost.accounts.*.botTokenchannels.matrix.accessTokenchannels.matrix.passwordchannels.matrix.accounts.*.accessTokenchannels.matrix.accounts.*.passwordchannels.nextcloud-talk.botSecretchannels.nextcloud-talk.apiPasswordchannels.nextcloud-talk.accounts.*.botSecretchannels.nextcloud-talk.accounts.*.apiPasswordchannels.zalo.botTokenchannels.zalo.webhookSecretchannels.zalo.accounts.*.botTokenchannels.zalo.accounts.*.webhookSecretchannels.googlechat.serviceAccount透過同層的serviceAccountRef(相容性例外)channels.googlechat.accounts.*.serviceAccount透過同層的serviceAccountRef(相容性例外)
auth-profiles.json 目標(secrets configure + secrets apply + secrets audit)
profiles.*.keyRef(type: "api_key";當auth.profiles.<id>.mode = "oauth"時不支援)profiles.*.tokenRef(type: "token";當auth.profiles.<id>.mode = "oauth"時不支援)
注意事項:
- 認證設定檔方案目標需要
agentId;方案項目以profiles.*.key/profiles.*.token為目標,並寫入同層參照(keyRef/tokenRef)。認證設定檔參照涵蓋於執行階段解析和稽核範圍中。 - 在
openclaw.json中,SecretRef 必須使用結構化物件,例如{"source":"env","provider":"default","id":"DISCORD_BOT_TOKEN"}。SecretRef 認證資訊路徑會拒絕舊版secretref-env:<ENV_VAR>標記字串;請執行openclaw doctor --fix以遷移有效標記。 - OAuth 政策防護:
auth.profiles.<id>.mode = "oauth"不得與該設定檔的 SecretRef 輸入合併使用。若違反此政策,啟動/重新載入和認證設定檔解析會立即失敗。 - 對於由 SecretRef 管理的模型供應商,產生的
agents/*/agent/models.json項目會為apiKey/標頭介面保留非密鑰標記(而非解析後的密鑰值)。標記持久化以來源為準:OpenClaw 會從有效的來源設定快照(解析前)寫入標記,而非從解析後的執行階段密鑰值寫入。 - 閘道冷啟動可隔離已對應且非閘道擁有者的可重試解析失敗。目前已對應的類別包括模型供應商和 Skills、媒體/TTS/排程供應商、符合條件的認證設定檔、個別代理程式記憶體、沙箱 SSH、頻道帳號,以及資訊清單宣告的外掛路由。啟動時會在執行階段快照中保留各失敗擁有者的明確參照,透過狀態和 doctor 回報該擁有者,並拒絕該擁有者的要求,而不嘗試較低優先順序的認證資訊。重新載入和設定寫入預檢採用相同的擁有者感知政策:狀態正常的擁有者會重新整理;符合條件且失敗的擁有者,只有在其參照身分、供應商定義及完整的非密鑰擁有者合約均未變更時,才會維持過期狀態;新的或已變更的失敗則會轉為冷狀態。閘道輸入驗證、結構無效的參照或值、失敗即關閉的擁有者,以及目前未對應的擁有者,仍採嚴格處理。
- 對於網頁搜尋:在明確供應商模式下(已設定
tools.web.search.provider),只有所選供應商金鑰處於有效狀態。在自動模式下(未設定tools.web.search.provider),只有依優先順序成功解析的第一個供應商金鑰處於有效狀態,而未選取的供應商參照在被選取前會視為非作用中。供應商認證資訊使用plugins.entries.<plugin>.config.webSearch.*。 - Slack
identity: "user"在 Socket Mode 中搭配channels.slack.appToken使用channels.slack.userToken,或在 HTTP 模式中搭配channels.slack.signingSecret使用。相同的配對也適用於channels.slack.accounts.*;此身分不需要機器人權杖。
不支援的認證資訊
這些認證資訊屬於系統建立、輪替、帶有工作階段,或可長期使用的 OAuth 類別,不適用於唯讀的外部 SecretRef 解析:
hooks.tokenhooks.gmail.pushTokenhooks.mappings[].sessionKeyauth-profiles.oauth.*channels.discord.threadBindings.webhookTokenchannels.discord.accounts.*.threadBindings.webhookTokenchannels.whatsapp.creds.jsonchannels.whatsapp.accounts.*.creds.json
相關內容
Was this useful?