VirtuousAI

Authentication

CLI authentication configuration

Authentication

The VAI CLI supports multiple authentication methods and profiles.

Device Flow (Default)

The device flow is the recommended way to authenticate:

vai auth login

This will:

  1. Display a URL and code
  2. Open your browser automatically
  3. Wait for you to authorize
  4. Store the token securely

Manual Browser

If automatic browser opening fails:

vai auth login --no-browser

Check Status

View your current authentication status:

vai auth status

Example output:

Auth Status
┌─────────┬──────────────────────────────────────┐
│ Profile │ default                              │
│ Status  │ Authenticated                        │
│ User    │ user@example.com                     │
│ Name    │ John Doe                             │
│ Storage │ ~/.config/vai/credentials/default    │
└─────────┴──────────────────────────────────────┘

Logout

Remove stored credentials:

vai auth logout

Get Token

Print the current token (useful for scripting):

# Print token to stdout
vai auth token

# Use with curl
curl -H "Authorization: Bearer $(vai auth token)" \
  https://vai-dev.virtuousai.com/api/v1/connections

Profiles

Profiles allow you to manage multiple environments (dev, staging, prod).

List Profiles

vai auth profile list

Create Profile

Profiles are created automatically when you login:

vai auth login --profile staging

Switch Profile

# Set default profile
vai auth profile select staging

# Or use environment variable
export VAI_PROFILE=staging

Check Current Profile

vai auth profile current

Configuration File

Profiles are configured in ~/.config/vai/config.toml:

default_profile = "default"

[profiles.default]
api_url = "https://vai-dev.virtuousai.com"

[profiles.staging]
api_url = "https://staging.virtuousai.com"

[profiles.local]
api_url = "http://localhost:8000"

API Tokens

For CI/CD or automation, use API tokens instead of device flow:

# Set token via environment
export VAI_API_TOKEN=your-api-token
vai connections list

# Or create a Personal Access Token
vai tokens create --name "CI/CD Token"

Troubleshooting

Token Expired

vai auth login

Wrong Profile

# Check current profile
vai auth profile current

# Switch profile
vai auth profile select correct-profile

Storage Issues

# Check storage location
vai auth status

# Clear and re-authenticate
vai auth logout
vai auth login

On this page