tank_) are stored in ~/.tank/config.json.
login
Authenticate with the Tank registry via browser OAuth.Description
Starts a browser-based OAuth flow to authenticate with the Tank registry:- Generates a random state for CSRF protection
- POSTs to
/api/v1/cli-auth/startto create an auth session - Opens browser to GitHub OAuth authorization page
- Polls
/api/v1/cli-auth/exchangeevery 2 seconds for completion - Writes API token and user info to
~/.tank/config.json
Options
Maximum time to wait for authorization (milliseconds). Default: 5 minutes.
Interval between authorization polling requests (milliseconds). Default: 2 seconds.
Examples
Exit Codes
0- Successfully authenticated1- Authentication failed or timed out
Implementation Details
- Timeout: Default 5 minutes (300,000ms), configurable via options
- Poll Interval: Default 2 seconds (2,000ms)
- CSRF Protection: Random UUID state parameter
- Storage: Token and user info written to
~/.tank/config.json - API Key Format: Prefix
tank_followed by random characters
Error Messages
"Failed to start auth session: <error>"- Could not connect to registry"Login timed out. Please try again."- No authorization within timeout period"Exchange failed: <error>"- Unexpected error during polling
logout
Remove authentication token from config.Description
Removes the stored API token and user information from~/.tank/config.json. Does not revoke the token on the server.
Options
No options.Examples
Exit Codes
0- Success (even if not logged in)
Implementation Details
- Sets
tokenandusertoundefinedin config - Does not make any network requests
- Safe to run multiple times
whoami
Show the currently logged-in user.Description
Displays the current user’s name and email, and verifies the token is valid by making a request to/api/v1/auth/whoami.
Options
No options.Examples
Exit Codes
0- Token is valid1- Token is invalid, expired, or network error
Implementation Details
- Online Mode: Verifies token with
GET /api/v1/auth/whoami - Offline Mode: Falls back to cached user info from config if server unreachable
- Status Code Handling:
401- Token invalid or expired!ok(non-401) - Server error but shows cached user- Network error - Shows cached user with warning
API Endpoint
Common Patterns
Check Login Status
Re-authenticate
Scripting with Authentication
Configuration File
Authentication data is stored in~/.tank/config.json:
Token Scopes
API tokens generated viatank login have the following scopes:
skills:read- Read skill metadata and download tarballsskills:write- Publish new skill versionsorgs:read- Read organization membership