CLI Authentication
Two ways in: browser OAuth or device code flow for headless environments.
For API tokens and SDK auth, see Authentication.
Login Flows
Standard Flow
The login command opens your default browser to the Basilica auth page. After signing in and authorizing the CLI, credentials are stored locally.
Device Flow
For headless environments (WSL, SSH sessions, containers), use --device-code. The CLI displays a URL and code to enter in any browser.
Token Storage
Credentials are stored in ~/.local/share/basilica/auth.json containing:
- Access token (for API requests)
- Refresh token (for automatic renewal)
- Token expiration time
Never share or commit your auth.json file.
Session Management
Tokens are automatically refreshed when they expire. No manual action required.
To switch accounts, run logout then login again.
Troubleshooting
Browser doesn't open
Use device flow: basilica login --device-code
Failed to store tokens
Check permissions: ls -la ~/.local/share/basilica/
Ensure the directory exists and is writable:
mkdir -p ~/.local/share/basilica
chmod 700 ~/.local/share/basilicaDevice flow timeout
The code expires after 15 minutes. Run basilica login --device-code again for a new code.
Next Steps
- GPU Rentals: Rent GPU instances
- Deployments: Deploy applications
- Account Management: Manage tokens and SSH keys