KeyEnvKeyEnv

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

OptionDescription
-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.com

Notes

  • 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 logout

Examples

keyenv logout
# ✓ Logged out successfully

Notes

  • Removes the token from your keychain/credential store
  • You'll need to run keyenv login again to use the CLI

whoami

Display the currently authenticated user.

keyenv whoami

Examples

keyenv whoami
# User: [email protected]
# Server: https://api.keyenv.dev
# Current Project: my-project

JSON Output

keyenv whoami --json
{
  "id": "user_abc123",
  "email": "[email protected]",
  "name": "Your Name",
  "server": "https://api.keyenv.dev",
  "current_project": "my-project"
}

On this page