Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 24 additions & 9 deletions profiles/credentials.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,40 @@ Credentials are the automation layer for Managed Auth. Store login information s

## Save credentials during login

Add `save_credential_as` when starting a login flow. The credentials entered during login are securely stored:
By default, credentials entered during login are automatically saved for re-authentication. No extra parameters are needed:

<CodeGroup>
```typescript TypeScript
const login = await kernel.auth.connections.login(auth.id, {
save_credential_as: 'my-login',
});
const login = await kernel.auth.connections.login(auth.id);
```

```python Python
login = await kernel.auth.connections.login(
auth.id,
save_credential_as="my-login",
)
login = await kernel.auth.connections.login(auth.id)
```
</CodeGroup>

Once saved, the profile stays authenticated automatically. When the session expires, Kernel re-authenticates using the stored credentials—no user interaction needed.

To opt out of credential saving, set `save_credentials: false` when creating the connection:

<CodeGroup>
```typescript TypeScript
const auth = await kernel.auth.connections.create({
domain: 'example.com',
profile_name: 'my-profile',
save_credentials: false,
});
```

```python Python
auth = await kernel.auth.connections.create(
domain="example.com",
profile_name="my-profile",
save_credentials=False,
)
```
</CodeGroup>

## Pre-store credentials

For fully automated flows where no user is involved, create credentials upfront:
Expand Down Expand Up @@ -237,7 +252,7 @@ while state.flow_status == "IN_PROGRESS":
This is useful when you want to:
- Store TOTP secrets but have users enter their password each time
- Pre-fill username/email but collect password at runtime
- Merge user-provided values into an existing credential using `save_credential_as`
- Merge user-provided values into an existing credential automatically on successful login

## Security

Expand Down
21 changes: 3 additions & 18 deletions profiles/managed-auth/hosted-ui.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -208,26 +208,11 @@ if state.status == "AUTHENTICATED":

The basic flow above gets you started. Add these features as needed:

### Save Credentials for Auto-Reauth
### Credentials and Auto-Reauth

Capture the user's credentials during login so future sessions can re-authenticate automatically when the session expires:
Credentials are saved automatically on successful login, enabling automatic re-authentication when the session expires—no user interaction needed.

<CodeGroup>
```typescript TypeScript
const login = await kernel.auth.connections.login(auth.id, {
save_credential_as: 'my-saved-creds',
});
```

```python Python
login = await kernel.auth.connections.login(
auth.id,
save_credential_as="my-saved-creds",
)
```
</CodeGroup>

After successful login, future login sessions for this connection will automatically use the saved credentials—no user interaction needed. See [Credentials](/profiles/credentials) for more on automated authentication.
To opt out of credential saving, set `save_credentials: false` when creating the connection. See [Credentials](/profiles/credentials) for more on automated authentication.

### Custom Login URL

Expand Down
9 changes: 2 additions & 7 deletions profiles/managed-auth/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ auth = await kernel.auth.connections.create(

<CodeGroup>
```typescript TypeScript
const login = await kernel.auth.connections.login(auth.id, {
save_credential_as: 'my-netflix-creds', // Optional: save for auto-reauth
});
const login = await kernel.auth.connections.login(auth.id);

// Send user to login page
console.log('Login URL:', login.hosted_url);
Expand All @@ -56,10 +54,7 @@ if (state.status === 'AUTHENTICATED') {
```

```python Python
login = await kernel.auth.connections.login(
auth.id,
save_credential_as="my-netflix-creds", # Optional: save for auto-reauth
)
login = await kernel.auth.connections.login(auth.id)

# Send user to login page
print(f"Login URL: {login.hosted_url}")
Expand Down
17 changes: 1 addition & 16 deletions profiles/managed-auth/programmatic.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,7 @@ login = await kernel.auth.connections.login(auth.id)
```
</CodeGroup>

To save credentials for automatic re-authentication:

<CodeGroup>
```typescript TypeScript
const login = await kernel.auth.connections.login(auth.id, {
save_credential_as: 'my-saved-creds',
});
```

```python Python
login = await kernel.auth.connections.login(
auth.id,
save_credential_as="my-saved-creds",
)
```
</CodeGroup>
Credentials are saved automatically on successful login, enabling automatic re-authentication when the session expires.

### 3. Poll and Submit Credentials

Expand Down