Authentication Commands
CLI commands for authentication and user management.
Authentication Commands
Commands for managing your KeyEnv authentication.
login
Authenticate with the KeyEnv server.
keyenv login [OPTIONS]Options
| Option | Description |
|---|---|
-t, --token <TOKEN> | Use a service token instead of browser auth |
-s, --server <URL> | Specify a custom server URL |
Examples
# Interactive browser authentication
keyenv login
# Login with a service token (for CI/CD)
keyenv login --token env_abc123...
# Login to a self-hosted server
keyenv login --server https://keyenv.mycompany.comNotes
- Browser authentication opens your default browser
- Tokens are stored securely in your system keychain (macOS/Windows) or encrypted file (Linux)
- Service tokens are typically used in CI/CD environments
logout
Log out and clear stored credentials.
keyenv logoutExamples
keyenv logout
# ✓ Logged out successfullyNotes
- Removes the token from your keychain/credential store
- You'll need to run
keyenv loginagain to use the CLI
whoami
Display the currently authenticated user.
keyenv whoamiExamples
keyenv whoami
# User: [email protected]
# Server: https://api.keyenv.dev
# Current Project: my-projectJSON Output
keyenv whoami --json{
"id": "user_abc123",
"email": "[email protected]",
"name": "Your Name",
"server": "https://api.keyenv.dev",
"current_project": "my-project"
}