import Kernel from '@onkernel/sdk';
const client = new Kernel({
apiKey: process.env['KERNEL_API_KEY'], // This is the default and can be omitted
});
const response = await client.auth.connections.follow('id');
console.log(response);{
"event": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"flow_status": "IN_PROGRESS",
"flow_step": "DISCOVERING",
"flow_type": "LOGIN",
"discovered_fields": [
{
"name": "email",
"type": "email",
"label": "Email address",
"selector": "input#email",
"placeholder": "you@example.com",
"required": true,
"linked_mfa_type": "sms"
}
],
"mfa_options": [
{
"type": "sms",
"label": "Text me a code",
"target": "***-***-5678",
"description": "We'll send a 6-digit code to your phone"
}
],
"pending_sso_buttons": [
{
"selector": "xpath=//button[contains(text(), 'Continue with Google')]",
"provider": "google",
"label": "Continue with Google"
}
],
"external_action_message": "<string>",
"website_error": "<string>",
"error_message": "<string>",
"error_code": "<string>",
"post_login_url": "<string>",
"live_view_url": "<string>",
"hosted_url": "<string>"
}Establishes a Server-Sent Events (SSE) stream that delivers real-time login flow state updates. The stream terminates automatically once the flow reaches a terminal state (SUCCESS, FAILED, EXPIRED, CANCELED).
import Kernel from '@onkernel/sdk';
const client = new Kernel({
apiKey: process.env['KERNEL_API_KEY'], // This is the default and can be omitted
});
const response = await client.auth.connections.follow('id');
console.log(response);{
"event": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"flow_status": "IN_PROGRESS",
"flow_step": "DISCOVERING",
"flow_type": "LOGIN",
"discovered_fields": [
{
"name": "email",
"type": "email",
"label": "Email address",
"selector": "input#email",
"placeholder": "you@example.com",
"required": true,
"linked_mfa_type": "sms"
}
],
"mfa_options": [
{
"type": "sms",
"label": "Text me a code",
"target": "***-***-5678",
"description": "We'll send a 6-digit code to your phone"
}
],
"pending_sso_buttons": [
{
"selector": "xpath=//button[contains(text(), 'Continue with Google')]",
"provider": "google",
"label": "Continue with Google"
}
],
"external_action_message": "<string>",
"website_error": "<string>",
"error_message": "<string>",
"error_code": "<string>",
"post_login_url": "<string>",
"live_view_url": "<string>",
"hosted_url": "<string>"
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
The auth connection ID to follow.
SSE stream of auth connection state updates.
Union type representing any managed auth event.
Event type identifier (always "managed_auth_state").
"managed_auth_state"Time the state was reported.
Current flow status.
IN_PROGRESS, SUCCESS, FAILED, EXPIRED, CANCELED Current step in the flow.
DISCOVERING, AWAITING_INPUT, AWAITING_EXTERNAL_ACTION, SUBMITTING, COMPLETED Type of the current flow.
LOGIN, REAUTH Fields awaiting input (present when flow_step=AWAITING_INPUT).
Show child attributes
MFA method options (present when flow_step=AWAITING_INPUT and MFA selection required).
Show child attributes
SSO buttons available (present when flow_step=AWAITING_INPUT).
Show child attributes
Instructions for external action (present when flow_step=AWAITING_EXTERNAL_ACTION).
Visible error message from the website (e.g., 'Incorrect password'). Present when the website displays an error during login.
Error message (present when flow_status=FAILED).
Machine-readable error code (present when flow_status=FAILED).
URL where the browser landed after successful login.
Browser live view URL for debugging.
URL to redirect user to for hosted login.