| title | Overview |
|---|---|
| description | Maintain authenticated browser sessions for agents |
Managed Auth creates and maintains authenticated browser sessions for your AI agents. Store credentials once, and Kernel re-authenticates automatically when needed. When you launch Kernel browsers with Managed Auth connections, your agent starts already logged in and ready to go.
A **Managed Auth Connection** attaches an authenticated domain to a browser [profile](/auth/profiles) so you can automatically be logged in when you launch future browsers. A single profile can have multiple auth connections — one per domain you want to keep authenticated. ```typescript TypeScript const auth = await kernel.auth.connections.create({ domain: 'netflix.com', profile_name: 'netflix-user-123', }); ```auth = await kernel.auth.connections.create(
domain="netflix.com",
profile_name="netflix-user-123",
)Specify a [Credential](/auth/credentials) to enable re-authentication without user input.
// Send user to login page console.log('Login URL:', login.hosted_url);
// Poll until complete let state = await kernel.auth.connections.retrieve(auth.id); while (state.flow_status === 'IN_PROGRESS') { await new Promise(r => setTimeout(r, 2000)); state = await kernel.auth.connections.retrieve(auth.id); }
if (state.status === 'AUTHENTICATED') { console.log('Authenticated!'); }
```python Python
login = await kernel.auth.connections.login(auth.id)
# Send user to login page
print(f"Login URL: {login.hosted_url}")
# Poll until complete
state = await kernel.auth.connections.retrieve(auth.id)
while state.flow_status == "IN_PROGRESS":
await asyncio.sleep(2)
state = await kernel.auth.connections.retrieve(auth.id)
if state.status == "AUTHENTICATED":
print("Authenticated!")
// Navigate to the site—you're already logged in await page.goto('https://netflix.com');
```python Python
browser = await kernel.browsers.create(
profile={"name": "netflix-user-123"},
stealth=True,
)
# Navigate to the site—you're already logged in
await page.goto("https://netflix.com")
Redirect users to Kernel's hosted page. Add features incrementally: save credentials for auto-reauth, custom login URLs, SSO support.
Mount `<KernelManagedAuth />` on a route in your own app. Same flow as Hosted UI, rendered on your origin with a Clerk-style appearance API.
Build your own credential collection. Handle login fields, SSO buttons, MFA selection, and external actions (push notifications, security keys).
Managed Auth automates login flows — navigating login pages, filling credentials, handling SSO redirects, and completing MFA challenges. It keeps your profiles logged in across sessions.
The most valuable workflows live behind logins. Managed Auth provides:
- Works on any website - Login pages are discovered and handled automatically
- SSO/OAuth support - "Sign in with Google/GitHub/Microsoft" buttons work out-of-the-box, with common SSO provider domains automatically allowed
- 2FA/OTP handling - TOTP codes automated with automatic retry on expiry, SMS/email/push OTP are supported
- Post-login URL - Get the URL where login landed (
post_login_url) so you can start automations from the right page - Session monitoring - Automatic re-authentication when sessions expire with stored credentials
- Secure by default - Credentials encrypted at rest, never exposed in API responses, or passed to LLMs
| Feature | Description |
|---|---|
| Encrypted credentials | Values encrypted with per-organization keys |
| No credential exposure | Never returned in API responses or passed to LLMs |
| Encrypted profiles | Browser session state encrypted end-to-end |
| Isolated execution | Each login runs in an isolated browser environment |