Documentation Index
Fetch the complete documentation index at: https://docs.alterauth.com/llms.txt
Use this file to discover all available pages before exploring further.
What Are Managed Secrets?
Managed Secrets store API keys, service tokens, and other credentials for internal APIs in Alter Vault. They get the same security treatment as OAuth tokens: encrypted storage, zero exposure to application code, policy enforcement, and full audit logging.OAuth vs Managed Secrets: Use OAuth for third-party services where end users authorize access (Google, Slack, GitHub) — the
grant_id comes from the user completing the OAuth flow. Use Managed Secrets for internal APIs where credentials are already available — the grant_id comes from the Developer Portal when storing the secret. Once a grant_id is obtained, the SDK usage is identical.How They Work
Store a Secret
Add the API key, service token, or credentials via the Developer Portal’s Managed Secrets tab
Get the Grant ID
Each stored secret gets a
grant_id (UUID) — save this in application code or configCall vault.request()
Use the same
vault.request() method used for OAuth — just pass the secret’s grant_idStoring Managed Secrets
In the Developer Portal:- Open the app and go to Managed Secrets
- Click Add Provider — choose a pre-configured template (40+ services) or select Custom for any API
- Choose the credential type:
- Bearer Token — injected as
Authorization: Bearer <token> - API Key — injected as a custom header (e.g.,
X-API-Key: <key>) - Basic Auth — injected as
Authorization: Basic <base64> - AWS SigV4 — AWS Signature Version 4 (computed automatically)
- Bearer Token — injected as
- For custom secrets, you can also configure the header name, injection format, and additional injection rules for multi-header or query parameter authentication
- Click Store Secret on the provider to save the credential value. Give each grant a name and description for easy identification.
- Copy the
grant_idreturned
Using Managed Secrets via SDK
Usevault.request() exactly the same way as OAuth grants. The SDK auto-detects the grant type and injects the right header.
Dynamic Header Injection
Alter Vault automatically injects the credential in the correct header format based on the configured credential type:| Credential Type | Header Injected |
|---|---|
| Bearer Token | Authorization: Bearer <token> |
| API Key | Custom header (e.g., X-API-Key: <key>) |
| Basic Auth | Authorization: Basic <base64(user:pass)> |
| AWS SigV4 | AWS Signature Version 4 (computed automatically) |
vault.request() handles it.
Policy Enforcement
Managed secrets follow the same policy enforcement as OAuth grants. Available options:- Time-based access — restrict secret usage to business hours or weekdays
- IP allowlist — only allow access from specific IPs or CIDR ranges
Handling Policy Violations
When a policy denies access, the SDK raises specific exceptions depending on the denial type. Handle all three policy-related errors:| Error | When It’s Raised | Action |
|---|---|---|
GrantExpiredError | Cloned grant’s TTL has expired | Create a new grant or clone |
PolicyViolationError | Time-based restriction or IP allowlist denial | Use policy_error / policyError to programmatically identify the violated rule; adjust timing or IP |
ReAuthRequiredError | Connection was revoked or deleted | Re-store the credential in the Developer Portal |
Custom Policies
The built-in policy types (time-based, IP allowlist, connection TTL) cover common access control patterns. For more advanced requirements, Alter Vault supports custom policies tailored to specific use cases:- URL restrictions — limit which API endpoints a credential can be used against
- HTTP method restrictions — allow read-only access (GET only) for certain actors
- Rate limiting — cap how many requests a credential can serve per time window
- Custom rules — any logic tied to end-user identity, actor identity, or request context
Set up custom policies
Contact the team to configure custom policies for a specific use case.
Audit Logging
Every use of a managed secret is logged automatically, just like OAuth token access:- Who accessed the secret (actor identity, AI agent name)
- What API was called (HTTP method, URL)
- When it happened (timestamp)
- Why (the
reasonparameter) - Outcome (success, policy denial, error)
Use Cases
Airline Chatbot — Loyalty API
Airline Chatbot — Loyalty API
Store the airline loyalty program API key as a managed secret. The AI chatbot agent uses
vault.request() to check points balances, book reward flights, and manage member accounts — without the API key ever appearing in agent code.Healthcare App — Patient Records API
Healthcare App — Patient Records API
Store the EHR system’s service token as a managed secret. Policy enforcement ensures the token is only used during business hours from approved IP addresses. Every access is logged for HIPAA compliance.
SaaS Platform — Billing API
SaaS Platform — Billing API
Store the payment processor’s API key. The backend service calls billing endpoints through
vault.request(), with full audit logging of every charge and refund operation.Internal Microservices
Internal Microservices
Store service-to-service authentication tokens. Centralize credential management instead of scattering API keys across environment variables in multiple services.
Key Differences from OAuth
| OAuth Connections | Managed Secrets | |
|---|---|---|
| Who provides credentials | End user authorizes via OAuth flow | Developer stores via portal |
Where grant_id comes from | onSuccess callback after user completes Alter Connect | Developer Portal when storing a secret |
grant_id is per… | Per user (each user who authorizes gets their own) | Per service (one credential shared across the backend) |
| Setup | Alter Connect UI (frontend) or vault.connect() (headless) | Developer Portal → Managed Secrets → Store Secret |
| Token refresh | Automatic (OAuth refresh flow) | Manual (re-store when rotated) |
| User consent | Required (user logs in) | Not applicable (developer stores directly) |
| Visible in Wallet | Yes (users see their connections) | No (backend-only) |
vault.request() | Same method | Same method |
| Policy enforcement | Same | Same |
| Audit logging | Same | Same |
| Encryption | Same (AES-256-GCM) | Same (AES-256-GCM) |
Next Steps
Developer Portal
Set up managed secret providers
Quickstart
Step-by-step managed secrets integration
Architecture
Security model and encryption details
Audit Logs
Monitor managed secret access