Overview
Handler supports two authentication schemes for communicating with protected A2A agents:- Bearer Token: OAuth-style token in the
Authorizationheader - API Key: Custom or standard API key header (default:
X-API-Key)
Authentication Types
Handler implements authentication through theAuthCredentials class:
Using Bearer Token Authentication
Bearer tokens are commonly used with OAuth 2.0 and JWT-based authentication.- CLI
- TUI
- MCP Server
Pass the token directly with each command:Or save the token to your session:
How Bearer Tokens Work
When you set a bearer token, Handler adds it to theAuthorization header:
auth.py:60-62
Using API Key Authentication
API key authentication allows custom header names for flexibility with different agent implementations.- CLI
- TUI
- MCP Server
Using the default Using a custom header name:Save to session:
X-API-Key header:How API Keys Work
API key credentials are sent in a custom header:auth.py:65-79
Credential Application
Credentials are applied to HTTP requests through theA2AService:
Saving Credentials to Sessions
Persist credentials across Handler invocations using session storage.Verify storage
Credentials are saved to Implementation in
~/.handler/sessions.json:session.py:104-109:Managing Credentials
- View Credentials
- Clear Credentials
List sessions with credential status:Output:
Security Considerations
Authentication Required State
Agents can signal that authentication is required:service.py:91-93
auth-required state:
- Configure authentication credentials
- Resend the message or continue the task
- The agent processes the request with credentials
Next Steps
Sessions
Learn about session persistence and context management
TUI Guide
Use authentication in the interactive TUI
CLI Reference
Complete authentication CLI reference