Skip to content

Authentication

The CLI requires authentication to interact with your Controlinfra account.

Login

The simplest way to authenticate is through your browser:

bash
controlinfra login

This will:

  1. Open your default browser to the Controlinfra login page
  2. After you authenticate, the CLI will automatically receive your credentials
  3. Your session will be saved locally for future use

API Token Authentication

For CI/CD environments or headless servers, use an API token:

bash
controlinfra login --token <your-api-token>

You can generate API tokens from your account settings.

Environment Variable

You can also set your token as an environment variable:

bash
export CONTROLINFRA_TOKEN=your-api-token
controlinfra repos list

Check Current User

Verify you're logged in and see your account details:

bash
controlinfra whoami

Output:

┌──────────────────────────────────────────────────────────┐
│ Current User                                             │
├──────────────────────────────────────────────────────────┤
│ Email:       john@example.com                            │
│ Name:        John Doe                                    │
│ Role:        admin                                       │
│ Workspace:   My Team                                     │
└──────────────────────────────────────────────────────────┘

Logout

To clear your stored credentials:

bash
controlinfra logout

Configuration Storage

Credentials are stored securely in:

PlatformLocation
Linux~/.config/controlinfra-nodejs/config.json
macOS~/Library/Preferences/controlinfra-nodejs/config.json
Windows%APPDATA%\controlinfra-nodejs\Config\config.json

Custom API URL

For self-hosted installations, you can set a custom API URL:

bash
export CONTROLINFRA_API_URL=https://your-instance.example.com
controlinfra login

Next Steps

AI-powered infrastructure drift detection