Skip to main content
Managed Auth saves the durable fields a user enters during login, such as an email and password, so it can attempt eligible reauthentication later. A credential item backed by a Managed Auth connection lets your application reuse that saved credential with fill: your application or agent drives the login form in its own browser session, and Kernel writes the values, without collecting the credential a second time or returning it to your application. The item stores no values of its own. It reads the connection’s saved credential each time you read the item or invoke fill, so a password updated through Managed Auth is used immediately.
fill only writes stored values into fields you select. It doesn’t discover fields, navigate, submit forms, verify authentication, monitor the session, or reauthenticate. Your application or agent owns each of those steps.

When to use it

Fill from Managed Auth works best when:
  • your users already log in through Managed Auth with the Hosted UI, the React component, or the programmatic flow.
  • a login prompt appears in a browser session that your application or agent controls, and you want to reuse the credential Managed Auth already holds.
  • you want one credential per user, maintained by Managed Auth, instead of a second copy collected into a vault.
Choose Fill from Vault with a Kernel credential item when the credential isn’t collected through Managed Auth. Choose Managed Auth on its own when you want Kernel to run the login for you.

Requirements

  • The connection holds a Kernel credential. Managed Auth saves one by default after a successful login. A connection created with save_credentials: false qualifies only if you linked a pre-stored credential when creating it.
  • The connection’s credential is stored in Kernel. Connections backed by 1Password keep their values in 1Password and can’t back an item.
  • The connection, the vault, and the browser belong to the same project.

How it works

These examples continue in order, using GitHub as the login destination. Set KERNEL_API_KEY in your trusted backend environment. All examples use the default project.
1

Log in through Managed Auth

Create a connection and complete a login with the Hosted UI, the React component, or the programmatic flow. Managed Auth saves the fields the user entered once the login succeeds.
Before continuing, confirm the connection holds a saved Kernel credential. The connection’s credential field names it once it’s saved:
Wait for the saved credential, not for the connection’s status. A connection that’s NEEDS_AUTH still qualifies as long as it holds a saved credential.
2

Create the credential item from the connection

Create a vault for the user, then create a credential item whose spec names the connection. The item is created ready, and state.fields lists the field names you can fill.
The request returns 404 when no connection has that id, and 409 when the connection hasn’t saved any credential values yet, belongs to another project, or is backed by an external provider such as 1Password. The 409 error names the condition. Fix the connection through the Managed Auth API, for example by finishing the login, then create the item again. Repeating the same request for an existing key returns the existing item.
3

Attach the vault to a browser

Attach the vault when you create the browser. The attachment can’t change during the session and grants access to every item in the vault.
4

Navigate and identify the login fields

Your application or agent navigates to the login page and picks a selector for each field it wants filled. The selectors in the next step target GitHub’s login form; inspect the page and recheck them if it changes.
5

Invoke the fill operation

Retrieve the item, require ready and an advertised fill operation, then invoke fill with field names from state.fields and your selectors. Your application must authorize the destination before filling: fill doesn’t compare the page with the connection’s domain.
completed means the selected fields were filled, not that login succeeded. If fill fails, returns an uncertain outcome, or loses its response, stop and inspect the outcome rather than retrying automatically.
6

Submit and handle the response

After fill completes, your application or agent submits the login form once and verifies the site’s response. If the site asks for an authenticator code and state.fields includes totp, navigate to that prompt and invoke fill again with a single totp binding, for example { "field": "totp", "selector": "#app_totp" } on https://github.com/sessions/two-factor/app. Kernel generates the code at fill time. Some sites submit the code as soon as it’s entered, so check the page state after the fill. Handle any other prompt through your own interface.Delete the demo browser when finished. Deleting the item later doesn’t affect the connection or its credential.

What the item exposes

Reading the item describes the credential without returning any values:
Field names come from the login itself, so read them from state.fields instead of assuming them. Each entry carries a type of text, email, password, or totp. A totp entry appears when the credential includes a TOTP secret; fill writes a freshly generated code for it and never the secret. Entries change when the connection’s credential changes, and the item’s version stays at 1, so compare state.fields rather than version to observe changes.

Item status

Kernel computes the item’s status each time you read it, from the connection it points at. An unavailable item advertises no operations. Managed Auth owns the connection and its credential, so recover through the Managed Auth API. For no_credential and external_credential, start a new login or relink a Kernel credential; once the connection holds a saved Kernel credential again, the item reads it and reports ready without being recreated. For connection_not_found, the item can’t recover, because its connection_id is fixed: delete it and create a new item for the replacement connection.

How it differs from a Kernel credential item

  • There’s no collection form and no collect operation. Managed Auth collects the login.
  • The item can’t be edited. Change the credential through Managed Auth, by logging in again or updating the linked credential, and the item picks the change up.
  • Field names and types mirror the saved credential instead of a field list you declare. wait doesn’t apply, because the item is created ready.
  • Deleting the item leaves the connection and its credential in place. Deleting the connection or its credential makes the item unavailable.

Security boundary

fill writes real values into the browser. Page scripts, extensions, developer tools, and an agent with unrestricted browser access can read them afterwards. Attaching a vault grants a browser access to all of its items, so attach it only to sessions authorized to use every item, and keep fill requests in your trusted backend. fill doesn’t restrict credential items to the connection’s domain, so authorize the destination in your application before invoking it.

Next steps

Fill Browser Fields

Map credential fields to browser inputs and handle completed, failed, or unknown outcomes.

Managed Auth Credentials

How Managed Auth saves credentials during login and how to update them.

Connection Lifecycle

Health checks, reauthentication, and recovering a connection that needs input.