- 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 Auth Agent and Start Authentication
Same as Hosted UI
2
Poll and Submit
Poll until
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 an Auth Agent
2. Start Authentication
3. Poll and Submit Credentials
A single loop handles everything—initial login, 2FA, and completion:pending_fields array tells you what the login form needs:
Complete Example
Handling Different Input Types
The basic polling loop handlespending_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 agent 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:
pending_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
Thestep field indicates what the flow is waiting for:
Status Reference
Thestatus field indicates the overall invocation state:

