Authentication and configuration management for the Lightdash CLI, including OAuth2 login, token-based authentication, project selection, and diagnostics.
Authenticates to a Lightdash instance using OAuth2 (browser-based) or API token.
lightdash login [url] [options]Arguments:
url (optional) - Lightdash server URL with flexible parsing:
app) → https://app.lightdash.cloudhttps://http:// protocol (for local development)Options:
--token <token> - Login with API access token, bypasses OAuth--project <project uuid> - Select project after login (must be valid UUID)--verbose - Enable debug logging (default: false)Authentication Methods:
Usage Examples:
# Interactive OAuth login (uses saved URL)
lightdash login
# Login to Lightdash Cloud with shorthand
lightdash login app # https://app.lightdash.cloud
lightdash login eu1 # https://eu1.lightdash.cloud
# Login with full URL
lightdash login https://app.lightdash.cloud
# Login with domain only (adds https://)
lightdash login app.lightdash.cloud
# Login for local development
lightdash login http://localhost:3000
# Login with URL containing path (path is stripped)
lightdash login https://custom.lightdash.domain/projects/123
# Uses: https://custom.lightdash.domain
# Token-based login (bypasses OAuth)
lightdash login --token abc123xyz
# Login with token and select project
lightdash login --token abc123xyz --project abc-123-def-456
# Login and select project in one command (with OAuth)
lightdash login --project abc-123-def-456
# Login with verbose logging
lightdash login --verboseBehavior:
~/.config/lightdash/config.yaml--project flagChoose the active Lightdash project for subsequent commands.
lightdash config set-project [options]Options:
--name <project_name> - Set project by name (non-interactive)--uuid <project_uuid> - Set project by UUID (non-interactive)--verbose - Enable debug logging (default: false)Constraints:
--name and --uuid are mutually exclusive (cannot use both)Usage Examples:
# Interactive selection (shows list of available projects)
lightdash config set-project
# Set project by name (non-interactive)
lightdash config set-project --name "Production Project"
# Set project by UUID (non-interactive)
lightdash config set-project --uuid abc-123-def-456
# With verbose logging
lightdash config set-project --verboseBehavior:
--name or --uuid: Non-interactive selection~/.config/lightdash/config.yamlShows diagnostic information about the CLI environment and configuration.
lightdash diagnostics [options]Options:
--dbt - Include dbt debug output (default: false)--project-dir <path> - dbt project directory for dbt debug (default: .)--profiles-dir <path> - dbt profiles directory for dbt debug (default: auto-detected)--defer - Defer to manifest in --state directory (dbt option, default: undefined)--no-defer - Do not defer to manifest (dbt option, default: undefined)Information Displayed:
LIGHTDASH_API_KEY)--dbt flag used)--dbt flag used)Usage Examples:
# Basic diagnostics
lightdash diagnostics
# Include dbt debug information
lightdash diagnostics --dbt
# dbt debug with custom project directory
lightdash diagnostics --dbt --project-dir ./my-dbt-project
# dbt debug with custom profiles directory
lightdash diagnostics --dbt --profiles-dir ~/.dbtUse Cases:
Location: ~/.config/lightdash/config.yaml
Structure:
user:
userUuid: string # Authenticated user UUID
anonymousUuid: string # Anonymous tracking UUID
organizationUuid: string # Organization UUID
context:
serverUrl: string # Lightdash server URL
project: string # Active project UUID
projectName: string # Active project name
apiKey: string # Personal Access Token or Service Account Token
proxyAuthorization: string # Proxy authorization header (if needed)
previewProject: string # Last preview project UUID
previewName: string # Last preview project name
answers:
permissionToStoreWarehouseCredentials: booleanNotes:
Environment variables override configuration file values:
# Authentication
export LIGHTDASH_API_KEY="your-api-token"
export LIGHTDASH_URL="https://app.lightdash.cloud"
# Project selection
export LIGHTDASH_PROJECT="project-uuid"
# Proxy configuration
export LIGHTDASH_PROXY_AUTHORIZATION="Bearer proxy-token"
# CI mode (disables interactive prompts)
export CI="true"Variable Priority:
CI/CD Usage:
# In CI/CD pipeline, set environment variables
export LIGHTDASH_API_KEY="${SECRET_LIGHTDASH_TOKEN}"
export LIGHTDASH_PROJECT="${LIGHTDASH_PROD_PROJECT}"
export CI="true"
# Commands will use these values automatically
lightdash deploylightdash login [url]Advantages:
Use Cases:
Use Personal Access Tokens (PAT) or Service Account Tokens:
# Create token in Lightdash UI: Settings > Personal Access Tokens
# Login with token
lightdash login --token your-token-here
# Or set environment variable
export LIGHTDASH_API_KEY="your-token-here"
lightdash deploy # Uses token from environmentAdvantages:
Use Cases:
Security Notes:
The login command normalizes URLs for convenience:
| Input | Normalized URL |
|---|---|
app | https://app.lightdash.cloud |
eu1 | https://eu1.lightdash.cloud |
app.lightdash.cloud | https://app.lightdash.cloud |
custom.domain.com | https://custom.domain.com |
https://custom.com/projects/123 | https://custom.com |
http://localhost:3000 | http://localhost:3000 (preserved) |
Rules:
https://<word>.lightdash.cloudhttps://http:// is preserved (for local development)Error: "AuthorizationError"
lightdash login againError: "ForbiddenError"
No projects available:
lightdash deploy --createProject not found:
lightdash config set-project to select valid projectUse diagnostics to debug:
# Check dbt installation and configuration
lightdash diagnostics --dbt
# Verify dbt profiles
cat ~/.dbt/profiles.yml
# Test dbt connection
dbt debugThe CLI is optimized for Node.js v20. If using a different version, you may see warnings:
⚠️ You are using Node.js version v18.x.x. Lightdash CLI is optimized for v20 so you might experience issues.Recommendation: Install Node.js v20 for best compatibility.