Authentication
The WhookTown CLI uses token-based authentication. You can log in interactively or use tokens for automation.
Interactive Login
Email Magic Link
Flow:
- Enter your email address when prompted
- Check your email inbox
- Click the validation link
- CLI automatically saves the token
The token is stored in ~/.whooktown/config.yaml.
Verify Login
Output:
Logout
Removes the stored token from the config file.
Token Authentication
For automation and scripts, use tokens directly.
Using --token Flag
Environment Variable
In Config File
The config file stores tokens per context:
Token Management
List Tokens
Output:
NAME TYPE STATUS TOKEN
My Script sensor valid eyJh...xyz
Dashboard viewer valid eyJh...abc
Expired Token user expired eyJh...def
Create Token
Options:
| Flag | Description |
|---|---|
--name |
Descriptive name for the token |
--type |
Token type: user, sensor, or viewer |
Output:
Token created successfully!
Token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
⚠️ Save this token now - it won't be shown again!
Save your token
The full token is only displayed once. Copy it immediately.
Token Types
| Type | Permissions | Use Case |
|---|---|---|
user |
Full user access | General automation |
sensor |
Sensor write only | Monitoring integrations |
viewer |
Read-only access | Dashboard displays |
Revoke Token
The token is immediately invalidated. Any systems using it will lose access.
Multi-Environment Contexts
Manage multiple environments (dev, staging, prod) with contexts.
List Contexts
Output:
Switch Context
All subsequent commands use the dev context's token and settings.
Context Configuration
Each context can have:
contexts:
prod:
name: prod
token: "eyJ..."
environment: PROD
default_layout: "layout-uuid"
dev:
name: dev
token: "eyJ..."
environment: DEV
# Custom URLs for self-hosted
auth_url: "https://auth.dev.example.com"
sensor_url: "https://sensor.dev.example.com"
ui_url: "https://api.dev.example.com"
Per-Command Override
Use --env to override context for a single command:
Troubleshooting
"Not logged in"
"Invalid token"
- Verify the token is copied correctly (full token, not truncated)
- Check if the token has expired
- Try creating a new token
"Connection error"
Token Not Found in Email
- Check spam/junk folder
- Verify email address is correct
- Wait a few minutes and try again
- Contact support if issues persist