Overview
TheAuthenticationAgent is an authentication-focused specialization of the OffensiveSecurityAgent that handles automated authentication flows. It detects authentication schemes, logs in with provided credentials, manages sessions, and exports authentication state for other agents.
Credentials are managed automatically via the session’s CredentialManager — the agent never sees raw secrets. The credential manager is provisioned automatically when you create a session with authCredentials.
Key Features
- Automatic Scheme Detection: Detects form-based, JSON, Basic Auth, Bearer, OAuth, and API key authentication
- Credential Security: Uses CredentialManager to resolve credentials without exposing secrets to the model
- Browser Automation: Handles SPAs, OAuth flows, CAPTCHA, and MFA with browser tools
- Session Export: Exports cookies and headers for use by other agents
- Email Integration: Supports email-based verification flows (OTP, magic links)
- Flow Documentation: Documents auth flows for future runs
Constructor
AuthenticationAgentInput
required
Configuration object for the authentication agent
AuthenticationAgentInput
string
required
The target requiring authentication (URL or domain)
AIModel
required
AI model identifier (e.g.,
"claude-sonnet-4-20250514")SessionInfo
required
Session that provides paths and, when created with
authCredentials, an auto-provisioned CredentialManagerAuthHints
AIAuthConfig
Optional per-provider API key overrides
StreamTextOnStepFinishCallback<ToolSet>
Optional callback after each agent step
AbortSignal
AbortSignal to cancel mid-run
ConsumeCallbacks
Optional persistence callbacks for external storage integration
Result Type
Theconsume() method returns an AuthenticationResult:
boolean
Whether authentication was successful
string
Summary of the authentication process
string
Exported cookies from the authentication process (e.g., “session_id=abc123; token=xyz789”)
Record<string, string>
Exported headers from the authentication process (e.g., Authorization, X-API-Key)
string
Strategy used for authentication (e.g., “form_post”, “bearer_token”, “oauth”)
AuthBarrier | undefined
string
Path to the persisted auth data file (inside session auth/ directory)
Active Tools
The AuthenticationAgent uses the following tools:execute_command- Run authentication-related commandsauthenticate_session- Attempt authentication with credentialscomplete_authentication- Mark authentication complete and export session databrowser_navigate- Navigate to login pagesbrowser_snapshot- Inspect login forms and page structurebrowser_screenshot- Capture screenshots for documentationbrowser_click- Click login buttons and linksbrowser_fill- Fill username/password fields (with secure credential resolution)browser_evaluate- Execute JavaScript for SPA interactionsbrowser_console- Access browser console for debuggingbrowser_get_cookies- Extract cookies after successful loginemail_list_inboxes- List available email inboxes (if configured)email_list_messages- List messages for verification codesemail_search_messages- Search for specific verification emailsemail_get_message- Retrieve verification codes or magic links
Usage Examples
Basic Authentication
With Authentication Hints
Multiple Credentials (Role-Based)
Token Verification (No Login Flow)
With Email Integration (MFA/OTP)
Using Exported Auth in Other Agents
Authentication Strategies
The agent supports multiple authentication strategies:- Form-Based Auth
- JSON API Auth
- Bearer Token
- API Key
- OAuth
Traditional HTML form login:
Authentication Barriers
The agent detects and reports various authentication barriers:- CAPTCHA: Visual or reCAPTCHA challenges
- MFA: Multi-factor authentication (email OTP, SMS, authenticator apps)
- OAuth Consent: Third-party OAuth consent screens
- Rate Limiting: Login attempt restrictions
- Invite Code: Registration requires invitation
- Admin Approval: Account requires manual approval
- Email Verification: Email verification required before login
- Phone Verification: Phone number verification required
authBarrier field of the result.
Persisted Auth Data
Authentication state is persisted to{session.rootPath}/auth/auth-data.json:
Convenience Runner
Best Practices
Auto-Provisioning: The CredentialManager is automatically provisioned when you create a session with
authCredentials. No need to create it manually.
