#What is SecretRef and how does it work?
1 messages ยท Page 1 of 1 (latest)
SecretRef is basically a pointer to a secret, not the secret itself.
How it works:
- You put a ref object in config, like:
{ source: "env", provider: "default", id: "OPENAI_API_KEY" } - OpenClaw resolves that at startup or
openclaw secrets reload - The resolved value lives in the in-memory runtime snapshot
- If an active SecretRef cannot be resolved, startup/reload fails fast instead of silently running half-broken
Supported sources:
envfileexec(good for 1Password, Vault, custom resolver scripts)
Yes, you can use it for provider auth keys, with an important distinction:
- Yes for static API keys and tokens, including:
models.providers.*.apiKeyauth-profiles.jsonviakeyRef/tokenRef- various channel tokens and gateway token/password
- No for OAuth/session-style creds like
auth-profiles.oauth.*, WhatsApp creds, and other runtime-minted tokens
So the short answer is: yes for API keys, no for OAuth refresh/session material.
If you want the safest/simple path, Iโd usually recommend env-backed refs first. Then use:
openclaw secrets configureopenclaw secrets auditopenclaw secrets reload
Docs: