Credential delegation
Hand an agent a scoped, revocable view of an OAuth connection it never sees the token for. Delegation can only ever narrow what an agent may do, never widen it.
Credential Delegation
Credential delegation lets agents safely access third-party OAuth services (Google, GitHub, Slack, etc.) without ever seeing refresh tokens. The platform acts as a proxy — agents receive short-lived access tokens through scoped, time-limited delegations.
How It Works
1. Register an OAuth provider with your client credentials (encrypted at rest with AES-256-GCM)
2. Store a connection — user authorizes OAuth access, refresh token is encrypted in the vault
3. Delegate to an agent — bind an agent to a connection with attenuated scopes
4. Agent requests a token — platform exchanges the refresh token and returns a short-lived access token
5. Everything is audited — every delegation, revocation, and token use is logged
Register an OAuth Provider
// Register a Google OAuth provider
await vorim.registerProvider({
provider_key: 'google',
display_name: 'Google Workspace',
client_id: 'your-google-client-id',
client_secret: 'your-google-client-secret',
auth_url: 'https://accounts.google.com/o/oauth2/v2/auth',
token_url: 'https://oauth2.googleapis.com/token',
scopes_available: ['drive.readonly', 'gmail.send', 'calendar.events'],
});typescriptStore an OAuth Connection
// After user completes OAuth consent flow
await vorim.storeConnection({
provider_id: 'provider-uuid',
refresh_token: 'ya29.a0AfH6SM...', // encrypted at rest
scopes_granted: ['drive.readonly', 'gmail.send'],
external_account_id: 'user@gmail.com',
});typescriptDelegate to an Agent
// Give an agent access to a subset of the connection's scopes
await vorim.delegateCredential({
connection_id: 'connection-uuid',
agent_id: 'agid_acme_a1b2c3d4',
scopes_delegated: ['drive.readonly'], // must be ⊆ connection scopes
max_requests_per_hr: 100,
valid_until: '2026-04-30T00:00:00Z',
});typescriptAgent Requests a Token
// Agent requests a short-lived access token
const token = await vorim.requestToken({
agent_id: 'agid_acme_a1b2c3d4',
scope: 'drive.readonly',
});
// Use the token (expires in ~1 hour)
const response = await fetch('https://www.googleapis.com/drive/v3/files', {
headers: { Authorization: `${token.token_type} ${token.access_token}` },
});typescriptRevoke a Delegation
Revoking a delegation cascades to all downstream delegation chains. Revocation is immediate.
// Revoke agent's access (cascades to all chains)
await vorim.revokeDelegation('delegation-uuid');
// Or revoke the entire connection (revokes ALL delegations)
// DELETE /v1/credentials/connections/:idtypescriptPython SDK
from vorim import Vorim
client = Vorim(api_key="agid_sk_live_...")
# Register provider
client.register_provider(
provider_key="github",
client_id="your-github-client-id",
client_secret="your-github-client-secret",
auth_url="https://github.com/login/oauth/authorize",
token_url="https://github.com/login/oauth/access_token",
)
# Delegate to an agent
client.delegate_credential(
connection_id="connection-uuid",
agent_id="agid_acme_a1b2c3d4",
scopes_delegated=["repo:read"],
)
# Agent requests a token
token = client.request_token(
agent_id="agid_acme_a1b2c3d4",
scope="repo:read",
)pythonSecuritynoteBook a demo for a walkthrough, or contact us for support. For enterprise needs, reach out at sales@vorim.ai.