runAuthenticationAgent
Drives a target’s login flow with an AI agent and returns reusable authentication material. The agent uses a real browser and can work through form logins, OAuth, SPAs, CSRF tokens, and email or SMS one-time codes (if inboxes are configured). Use the exported cookies and headers to authenticate other tools or pentest runs.
The model never sees your raw secrets. Credentials go into the session’s authCredentials, and tools resolve them at execution time.
Parameters
The application to authenticate against.
A session created with config.authCredentials. Its credential manager supplies secrets to the agent. See sessions.
Model ID. See Models.
AI provider credentials.
Optional hints about the login flow. protectedEndpoints gives the agent URLs to verify the session against.
Free-form context about the application.
Streaming events. See AgentEventBus.
Cancels the run.
Returns
Promise<AuthenticationResult>
Whether the agent authenticated.
What the agent did and why it succeeded or failed.
How the agent authenticated: browser, form_post, json_post, basic_auth, or bearer. unknown if it couldn’t tell.
Session cookies, formatted for a Cookie header.
Headers to send on authenticated requests, such as Authorization.
Set when the agent hit a barrier, such as a CAPTCHA or MFA it couldn’t complete.
Path to the auth data the agent saved in the session’s auth/ directory.