auth - Configure credentials and profiles¶
Configure authentication tokens and manage profiles. Each profile stores credentials for a different project or environment.
Examples¶
# Save a token (secure prompt, no echo)
contree auth
# Save to a named profile
contree auth --profile=personal
# Force overwrite existing profile
contree auth -y
# List all profiles and probe whether they work
contree auth ls
# Structured output for scripts and agents
contree -f json auth ls
# List profiles without network probes
contree auth ls --offline
# Switch active profile
contree auth switch personal
# Remove a profile
contree auth remove personal
contree auth rm personal -y
Help output¶
Behavior¶
When you run contree auth, the CLI:
Prompts for the token securely via
getpass(no echo, not stored in shell history)Prompts for the project ID
Verifies the token with the API (
GET /v1/whoami)Writes credentials to
~/.config/contree/auth.iniIf the profile already exists, prompts for confirmation (use
-yto skip)
Flags¶
--token— API token (prompted securely if omitted)--url— API base URL (default:https://api.tokenfactory.nebius.com/sandboxes)--project— Project ID (prompted if omitted)--profile— Profile name (default:default)-y/--force— Overwrite existing profile without confirmation
Environment variable shortcuts¶
When CLI flags (--token, --url, --project) are not passed,
contree auth checks these environment variables before falling back
to an interactive prompt:
Variable |
Fallback for |
Priority |
|---|---|---|
|
|
flag > |
|
|
(see above) |
|
|
flag > env > type-specific default > prompt |
|
|
flag > |
|
|
(see above) |
These variables are read only during contree auth. Other commands
ignore them and read credentials strictly from the saved profile.
If the relevant variables are set, contree auth runs fully
non-interactively (no prompts):
export NEBIUS_API_KEY=eyJ...
export NEBIUS_AI_PROJECT=your-project-id
contree auth -y # no prompts, saves immediately
auth list¶
contree auth list (alias auth ls, profiles) prints every saved
profile from auth.ini and verifies each one against the API with a
2-second timeout, adding a status column that tells you at a glance
which profiles are usable. Pass --offline to suppress the probe
entirely when you only want to inspect what is saved locally.
Possible status values:
ok– probe succeeded and the token has thelistpermissioninactive– probe succeeded but the token lacks thelistpermission, meaning sandboxes are disabled on this projecttimeout– probe did not complete within 2 secondserror– probe failed for another reason, such as a bad token or another network/API erroroffline– you passed--offline, so no probe was attempted
For automation and agents, prefer:
contree -f json auth ls
contree -f json auth ls --offline
auth switch¶
contree auth switch NAME rewrites the active pointer in auth.ini
so subsequent commands resolve credentials from that profile. The
profile must already exist (created by contree auth --profile=NAME).
Switching does not touch token data, so it is safe to run as often as
you like to bounce between projects.
auth remove¶
contree auth remove NAME (aliases rm, del) deletes the profile
from auth.ini and removes its per-profile session database
(sessions-NAME.db). If the deleted profile was the active one, the
CLI promotes the first remaining profile to active (or falls back to
default if none remain). Confirmation is required unless -y is
passed.
contree auth remove personal
contree auth rm personal # alias
contree auth del personal -y # skip confirmation
Warning
Avoid --token=eyJ... on the command line — the token is visible in
process listings (ps) and shell history. Omit --token to use the
secure prompt instead.
Alternative authentication¶
Runtime commands always read credentials from the saved profile.
To authenticate without an interactive auth flow, either:
# 1. Bootstrap the profile non-interactively from environment vars
export CONTREE_TOKEN=eyJ...
export CONTREE_URL=https://api.tokenfactory.nebius.com/sandboxes
contree auth -y --type jwt
contree images
# 2. Or pass the token inline per-command (visible in process listings)
contree --token=eyJ... images
Setting CONTREE_TOKEN alone (without first running contree auth)
will not authenticate runtime commands.
See also¶
Install & Authenticate – full authentication guide
Configuration & Profiles – config file format and precedence