Skip to content

elvanto auth

Manage and verify API-key credentials. See Authentication for the full resolution rules.

Subcommands

Command Purpose
auth login Store an API key in the OS keyring
auth clear Remove the keyring-stored key
auth status Report source (env / keyring / none) + verify against Elvanto

auth login

elvanto auth login [--stdin]

Prompts interactively for an API key (input is hidden via rpassword) and stores it in the OS keyring. The stored key is then used as the fallback after ELVANTO_API_KEY.

Flag Description
--stdin Read the key from stdin (one line) instead of prompting. Useful in scripts.
# Interactive
elvanto auth login

# Scripted
printf '%s\n' "$ELVANTO_API_KEY" | elvanto auth login --stdin

A successful login prints stored API key in keyring to stderr.

auth clear

elvanto auth clear

Deletes the keyring entry. Prints removed API key from keyring if a key was present, or no API key stored in keyring if nothing was stored. Does not touch the environment.

auth status

elvanto auth status

Reports which source elvanto would use for the API key (env (ELVANTO_API_KEY), keyring, or none), prints the redacted key, and performs a live verification by hitting songs/categories/getAll.

Typical output:

source: env (ELVANTO_API_KEY)
key:    abcd…wxyz
status: ok

or, with a bad key:

source: env (ELVANTO_API_KEY)
key:    wron…rong
status: invalid — Elvanto returned code 121: Invalid API Key.

or, with nothing configured:

source: none
status: no API key — run `elvanto auth login` or set ELVANTO_API_KEY

Exits non-zero if no key is available or if Elvanto rejects the key — so it fits cleanly into set -e CI scripts.