Configuration
824e49fddb4dcc071fc8e72558aadea224704447. Version 2026.11.0-rc.1. License MIT. Status: source candidate; complete gate and disposable live suite are the qualification authority; not published and not production-qualified. This is the component's committed documentation, not proof of a distribution release or production qualification.
Profiles contain only connection URLs and the explicit unauthenticated HTTP opt-in. They do not contain credentials. By default the CLI uses $XDG_CONFIG_HOME/melodee/config.toml when XDG is absolute, otherwise $HOME/.config/melodee/config.toml. An explicit --config /path/config.toml overrides it. The first added profile becomes active.
melodee profile add development --url http://localhost:3000
melodee profile add home --url https://melodee.example.test
melodee profile list
melodee profile use home
melodee profile show
melodee status --profile development
melodee status --server https://melodee.example.test --timeout-secs 15
Use the actual API address; the example port is illustrative, not a deployment assumption. The server URL can include a reverse-proxy base path. Non-loopback HTTP requires explicit --allow-http for unauthenticated health only. Authenticated operations require HTTPS on a non-loopback origin even with --allow-http; the CLI refuses to send a bearer token there. Prefer HTTPS. No TLS bypass, query or credentials in URLs. --server and --profile conflict. --server is temporary. --allow-http on profile add persists the opt-in for that profile.
Writes are staged and use a cooperative .lock file adjacent to config. A failed/duplicate add does not overwrite the previous file. After an interrupted process, inspect for active writers before manually removing a stale lock; do not delete a lock while another process is writing. Use a private, trusted configuration directory.
Native authentication and stored credentials
Two published credential families are supported, and the CLI keeps them distinct:
-
Automation credential —
melodee auth loginuses the upstream device authorization grant. It requestscatalog.readby default; add only the scopes needed. The supported vocabulary iscatalog.read,catalog.favorite.write,playback.report,reporting.read,operations.read,operations.write,catalog.admin.readandcatalog.admin.write(the sharedAutomationScopevocabulary). Administrative scopes still require the matching account capability (admin_reports,admin_jobs,admin_storage,admin_catalog,admin_providers,admin_accounts); a credential scope never grants a capability the account lacks. The server supplies the user code, an absolute verification URI and approval details, the polling interval and a one-time 30-day scoped credential. The CLI obeys the interval (increasing it onslow_down), distinguishes pending, denial and expiry, and makes bounded retries on transient network errors. This credential is not refreshable; after expiry or revocation, runauth loginagain. -
Interactive native session —
melodee auth login --method magic-link --email EMAILrequests a magic link, then confirms its one-time 64-hex token as a native client (from--link-token-fileor stdin). The API returns a native bearer only to requests without browserOrigin/Sec-Fetch-*headers; the CLI never reads a browser cookie or a browser JSON body. This session carries the account's rights, has arotateAtMillisdeadline and an absolute family expiry, rotates throughPOST /auth/refresh, and ends throughPOST /auth/logout. The CLI rotates before the deadline at client construction and, after one401, performs exactly one refresh and one bounded retry.
The selected credential is stored with the Linux user-scoped systemd-creds
store (systemd 256+), encrypted with the host/TPM key, in
$XDG_STATE_HOME/melodee/cli-credentials (or
$HOME/.local/state/melodee/cli-credentials). The directory is private and each
ciphertext file is mode 0600. Files are keyed by profile and server URL; the
stored metadata is checked against the selected target before use, so one
server's credential is never sent to another. There is no plaintext fallback:
if the OS store is unavailable, login fails instead of writing a plaintext token.
Only Linux + systemd-creds 256+ is supported; other platforms are not claimed.
auth status reports the credential type, account, scopes or rotation deadlines
and the store without printing the token; --verify checks it against
GET /capabilities. auth logout calls the appropriate published endpoint
(/auth/automation-tokens/self or /auth/logout) and removes the local credential
only after the server accepts revocation. If the server is unavailable the local
credential is retained and the command fails; --local-only explicitly removes it
without remote revocation. auth refresh is valid only for an interactive
session; asking it to refresh a device-grant automation credential is an explicit
configuration error.
The API returns an absolute {MELODEE_PUBLIC_BASE_URL}/auth/device verification
URI and a consent-details response (account, client, scopes, expiry). Approval is
performed by an authorized recent session/Auth UI; the CLI never approves or
escalates itself. The real browser Auth UI and independent security review remain
qualification gates, not implementation claims.
Interactive-session boundary
The 1.0.0 authorization table permits automation credentials only on catalog,
favorite, play-back reporting and administrative routes. MQL, playlists, listener
preferences/ratings/dislikes, user-state portability, history/statistics, public
shares, personal notifications, account-security management, automation-token
management and compatibility-credential management require an interactive
session. The CLI surfaces this as INTERACTIVE_SESSION_REQUIRED; it does not
retry, bypass the check or invent another authentication mechanism.
C3 test/automation credential
The documented disposable scoped automation credential remains supported for initial C3 integration and unattended automation. It is not production authentication and is not stored in the TOML profile.
export MELODEE_AUTOMATION_TOKEN="$(cat /run/secrets/melodee-test-token)"
# or a regular file with mode 0600:
melodee --token-file ~/.config/melodee/token favorite list
The token may not be passed as a command-line value. --token-file and the
environment variable are mutually exclusive; the file must be a regular,
non-symlink file with no group/world permissions. Tokens are sent only as an
Authorization: Bearer header to loopback or HTTPS origins, never through
redirects or to another origin, and are never printed or written to config.
Browser-only OAuth/passkey ceremonies remain browser-owned. Explicit tokens take
precedence over a stored login, and auth login/auth logout refuse to run while
one is active so the CLI never silently mixes credential sources. A --token-file
may contain either an automation credential or a native session bearer supplied by
an external authorized process; the CLI never writes such a file.