diff --git a/profiles/credentials.mdx b/profiles/credentials.mdx index 491342d..7b990ab 100644 --- a/profiles/credentials.mdx +++ b/profiles/credentials.mdx @@ -16,25 +16,40 @@ Credentials allow you to store login information securely and enable Kernel's au ## 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: ```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) +``` + + +Once saved, the profile stays authenticated automatically. When the session expires, Kernel re-authenticates using the stored credentials. Credentials are updated after every successful login. One-time codes (TOTP, SMS, etc.) are not saved. + +To opt out of credential saving, set `save_credentials: false` when creating the connection: + + +```typescript TypeScript +const auth = await kernel.auth.connections.create({ + domain: 'example.com', + profile_name: 'my-profile', + save_credentials: false, }); ``` ```python Python -login = await kernel.auth.connections.login( - auth.id, - save_credential_as="my-login", +auth = await kernel.auth.connections.create( + domain="example.com", + profile_name="my-profile", + save_credentials=False, ) ``` -Once saved, the profile stays authenticated automatically. When the session expires, Kernel re-authenticates using the stored credentials. - ## Pre-store credentials For fully automated flows where no user is involved, create credentials upfront: @@ -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 diff --git a/profiles/managed-auth/hosted-ui.mdx b/profiles/managed-auth/hosted-ui.mdx index f32b573..b2dba0e 100644 --- a/profiles/managed-auth/hosted-ui.mdx +++ b/profiles/managed-auth/hosted-ui.mdx @@ -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 after every successful login, enabling automatic re-authentication when the session expires. One-time codes (TOTP, SMS, etc.) are not saved. - -```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", -) -``` - - -After successful login, future login sessions for this connection will automatically use the saved credentials without requiring user interaction. 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 diff --git a/profiles/managed-auth/overview.mdx b/profiles/managed-auth/overview.mdx index cdaab83..e64f65f 100644 --- a/profiles/managed-auth/overview.mdx +++ b/profiles/managed-auth/overview.mdx @@ -38,9 +38,7 @@ auth = await kernel.auth.connections.create( ```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); @@ -58,10 +56,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}") diff --git a/profiles/managed-auth/programmatic.mdx b/profiles/managed-auth/programmatic.mdx index b513ac6..601faaa 100644 --- a/profiles/managed-auth/programmatic.mdx +++ b/profiles/managed-auth/programmatic.mdx @@ -56,22 +56,7 @@ login = await kernel.auth.connections.login(auth.id) ``` -To save credentials for automatic re-authentication: - - -```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", -) -``` - +Credentials are saved automatically on successful login, enabling automatic re-authentication when the session expires. ### 3. Poll and Submit Credentials