Skip to main content
The pensar auth command automates authentication to web applications, handling login flows, token verification, and auth mechanism discovery.

Synopsis

Description

The auth command helps you:
  • Automatically authenticate to applications
  • Discover authentication mechanisms
  • Verify bearer tokens and API keys
  • Test existing session cookies
  • Export authentication data for pentesting
Authentication data is securely stored and never exposed to AI models. Only authentication results and metadata are processed by AI.

Required Arguments

string
required
Target URL to authenticate against.
Should point to the application’s authentication endpoint or base URL.

Authentication Options

string
Username for login.
Used for form-based or API authentication.
string
Password for login.
Passwords are never sent to AI models. They’re only used by browser automation tools.
string
API key for authentication.
Tests API key authentication schemes.
string
Bearer token to verify.
Verifies an existing JWT or bearer token.
string
Existing session cookies to verify.
Tests if existing cookies grant authenticated access.

Configuration Options

string
default:"claude-sonnet-4-5"
AI model to use for authentication discovery.
boolean
Disable browser automation tools.
Forces API-based authentication only (faster but may not work for complex login flows).
boolean
Only discover authentication requirements without attempting login.
Useful for understanding auth requirements before providing credentials.

Examples

Discover Authentication

Learn what authentication is required:

Form-Based Login

Authenticate with username/password:

API Key Verification

Test if an API key is valid:

Bearer Token Verification

Verify a JWT token:
Test existing cookies:

OAuth Authentication

For OAuth flows, use discovery first:

Authentication Methods Supported

Traditional HTML form login:
Handles:
  • CSRF tokens
  • Hidden form fields
  • POST/GET methods
  • Session cookies

Use Cases

Pentesting Authenticated Apps

Get auth data before running pentest

Token Validation

Verify JWT tokens and API keys

Auth Flow Testing

Test OAuth and complex auth flows

Session Management

Reuse sessions across multiple pentests

Exported Authentication Data

Authentication data is saved to ~/.pensar/auth/<domain>/session.json:
Use in pentest:

Troubleshooting

Common causes:
  1. Incorrect credentials - Verify username/password
  2. CAPTCHA present - May require manual solving
  3. Rate limiting - Target may block automated login
  4. MFA required - See Authentication Guide for MFA support
Check:
Use jwt.io to decode and inspect tokens.
Try without browser:
Or ensure browser dependencies are installed:

Next Steps

Authentication Guide

Learn about advanced auth scenarios

Run Pentest

Use auth data for authenticated pentesting

Sessions

Manage authentication sessions

API Reference

Programmatic authentication API