auth command manages authentication credentials for AI providers that support OAuth flows or require secure token storage.
Usage
Subcommands
login
Authenticate with a provider using OAuth or token paste.Provider to authenticate withSupported providers:
openai- OpenAI OAuth or tokenanthropic- Token paste only
Use device code flow instead of browser (for headless environments)Only applies to OpenAI OAuth.
logout
Remove stored credentials for one or all providers.Specific provider to logout fromIf omitted, logs out from all providers.
status
Show current authentication status for all providers.Authentication Methods
OpenAI OAuth (Browser Flow)
Best for local development with browser access:- Opens browser to OpenAI OAuth page
- User grants permissions
- Weaver receives OAuth token
- Token stored securely with refresh capability
OpenAI OAuth (Device Code Flow)
For headless servers or environments without browser:- Displays activation URL and code
- User visits URL on any device
- User enters code and grants permissions
- Weaver polls for completion
Token Paste (Anthropic, OpenAI)
For providers without OAuth or manual token entry:Credential Storage
Credentials are stored at:- Location:
~/.weaver/auth.json - Format: Encrypted JSON
- Permissions: 0600 (owner read/write only)
Token Refresh
Weaver automatically refreshes OAuth tokens:- Trigger: When token expires or needs refresh
- Mechanism: Uses stored refresh token
- Fallback: Prompts for re-authentication if refresh fails
Examples
Status Values
| Status | Description |
|---|---|
| active | Token is valid and not expiring soon |
| needs refresh | OAuth token approaching expiry |
| expired | OAuth token expired (will auto-refresh) |
Integration with Config
When you authenticate viaauth login, Weaver updates config.json:
Exit Codes
| Code | Reason |
|---|---|
| 0 | Success |
| 1 | Invalid provider |
| 1 | Authentication failed |
| 1 | Failed to save credentials |
| 1 | Failed to load auth store |
Error Handling
Missing Provider
Unsupported Provider
OAuth Failure
Token Paste Error
Credential Save Error
~/.weaver/ directory has correct permissions.
Security Best Practices
Related Commands
weaver status- Shows auth status in system overviewweaver onboard- Initial setup without auth