auth_context_id. Tokens are encrypted at rest with ChaCha20-Poly1305 — only a masked preview is ever exposed in API responses, making auth contexts safe to log and inspect without leaking secrets.
When to use auth contexts
Consider storing credentials as auth contexts when:- You want to avoid embedding tokens in client code, request logs, or orchestration configs
- You invoke the same agent repeatedly from multiple callers that share a credential
- You want to manage and rotate credentials centrally without redeploying callers
Register an auth context
Send aPOST to /v1/auth-contexts/register with the credential details. The provider_id you supply must match the provider that owns the target agent — the gateway enforces this at invocation time.
secret_ref UUID pointing to the encrypted blob, and returns the new AuthContextRecord:
token_preview shows only the first few characters of the original token followed by asterisks. The full token is never returned in any API response after registration.Request fields
The DID of the credential owner — typically the agent caller or the identity asserting ownership of this credential.
The provider this credential is scoped to. Must match the
provider_id of any agent you intend to invoke using this auth context. The gateway rejects invocations where the auth context provider does not match the target agent’s provider.Describes how the credential will be injected into downstream A2A calls. See Auth model options below.
The plaintext credential to encrypt and store. This value is encrypted immediately on write and is never stored or returned in plaintext.
Optional ISO 8601 timestamp. If set, the gateway rejects invocations that reference this auth context after the expiry time, returning HTTP 403.
Auth model options
Use an auth context in invocations
Passauth_context_id in place of auth_token when calling /v1/agents/:agent_id/invoke. The gateway resolves the stored credential, decrypts it, and injects it into the downstream A2A call automatically.
List auth contexts
Retrieve all registered auth contexts, optionally filtered byprovider_id or subject_did:
items array. Each item is an AuthContextRecord with token_preview instead of the plaintext token.
Node configuration
Auth contexts require Then pass it as an environment variable when starting the node:
SERVICENET_SECRET_BROKER_KEY to be set on the node. This must be a base64-encoded 32-byte key used to derive the ChaCha20-Poly1305 encryption key. Without it, any database-backed deployment will refuse to start, and auth context registration will fail.Generate a key with: