- You need a custom credential collection UI that matches your app’s design
- You’re building headless/automated authentication
- You have credentials stored and want to authenticate without user interaction
How It Works
1
Create Connection and Start Session
Same as Hosted UI
2
Poll and Submit
Poll until
flow_step becomes AWAITING_INPUT, then submit credentials3
Handle 2FA
If more fields appear (2FA code), submit again—same loop handles it
Getting started
1. Create a Connection
2. Start a Login Session
3. Poll and Submit Credentials
A single loop handles everything—initial login, 2FA, and completion:discovered_fields array tells you what the login form needs:
Complete Example
Handling Different Input Types
The basic polling loop handlesdiscovered_fields, but login pages can require other input types too.
SSO Buttons
When the login page has “Sign in with Google/GitHub/Microsoft” buttons, they appear inpending_sso_buttons:
Remember to set
allowed_domains on the connection to include the OAuth provider’s domain (e.g., accounts.google.com).MFA Selection
When the site offers multiple MFA methods, they appear inmfa_options:
discovered_fields to submit the code, or handle external actions for push/security key.
External Actions (Push, Security Key)
When the site requires an action outside the browser (push notification, security key tap), the step becomesAWAITING_EXTERNAL_ACTION:
Step Reference
Theflow_step field indicates what the flow is waiting for:
Status Reference
Theflow_status field indicates the current flow state:
The
status field indicates the overall connection state:
Real-Time Updates with SSE
For real-time UIs, you can stream login flow events via Server-Sent Events instead of polling:managed_auth_state events with the same fields as polling (flow_status, flow_step, discovered_fields, etc.) and terminates automatically when the flow reaches a terminal state.
Polling is recommended for most integrations. SSE is useful when building real-time UIs that need instant updates without polling delays.