Authentication
Authenticate the Sazabi CLI using browser-based OAuth or API keys for automated workflows.
The Sazabi CLI supports two authentication methods: browser-based OAuth for interactive use, and API keys for scripts and CI pipelines.
Logging in
Authenticate using your Sazabi account:
sazabi auth loginThis opens your default browser where you can log in to Sazabi. Once authenticated, the CLI stores your credentials locally and you can start running commands.
The CLI stores credentials in ~/.sazabi/settings.json. This file is only
readable by your user account.
Profiles
If you work with multiple Sazabi accounts or organizations, use profiles to switch between them without logging out.
Creating profiles
Create a named profile when logging in:
sazabi auth login --profile work
sazabi auth login --profile personalUsing profiles
Set the active profile for a single command using the SAZABI_PROFILE
environment variable:
SAZABI_PROFILE=work sazabi projects listOr use the --profile flag:
sazabi projects list --profile workDefault profile
When no profile is specified, the CLI uses the default profile. The first
time you run sazabi auth login without a profile name, it creates the default
profile.
Environment variables
Configure the CLI using environment variables. These are useful for CI/CD pipelines and scripts where interactive authentication is not possible.
| Variable | Description |
|---|---|
SAZABI_PROFILE | Select which profile to use |
SAZABI_TOKEN | Use an API key instead of OAuth credentials |
SAZABI_ORG_ID | Override the default organization |
SAZABI_PROJECT_ID | Override the default project |
Using API keys
For automated workflows, use an API key instead of OAuth:
export SAZABI_TOKEN="sk_live_..."
sazabi logs tailAPI keys provide full access to your organization. Store them securely and never commit them to source control.
You can create API keys in the Sazabi dashboard under Settings > API Keys.
Verifying authentication
Check your current authentication status:
sazabi auth whoamiThis shows:
- The currently active profile
- The authenticated user's email
- The default organization and project
Profile: default
User: you@example.com
Organization: Acme Corp
Project: production-apiLogging out
Remove stored credentials for a profile:
# Log out of the current profile
sazabi auth logoutTroubleshooting
Browser does not open
If the browser does not open automatically during login, copy the URL from the terminal and paste it into your browser manually.
"Invalid credentials" error
Your stored credentials may have expired. Run sazabi auth login to
re-authenticate.
"Organization not found" error
Your account may not have access to the organization. Check that:
- You are logged in with the correct account (
sazabi auth whoami) - Your account has been invited to the organization
- If using an API key, verify it belongs to the correct organization
Permission denied on settings file
The settings file at ~/.sazabi/settings.json may have incorrect permissions.
Fix them with:
chmod 600 ~/.sazabi/settings.json