Skip to main content

mr auth login

Authenticate with a username and password, mint a personal API token, and store it in the credentials file. The server must be running with -auth; with authentication disabled every caller is already an implicit administrator with no account of its own, and the mint step answers HTTP 400. The token is written to $MR_TOKEN_FILE, or $XDG_CONFIG_HOME/mahresources/token, or ~/.config/mahresources/token, mode 0600 and keyed by the server's origin, so a token stored for one server is never sent to another. Subsequent mr commands read that token automatically; override it any time with the MR_TOKEN environment variable.

Usage

mr auth login

Examples

Log in to the default server

mr auth login --username alice --password password1

Log in to a specific server and name the token

mr --server https://mr.example.com auth login --username alice --password password1 --name laptop

Flags

FlagTypeDefaultDescription
--usernamestring``Account username
--passwordstring``Account password
--namestringmr cliLabel for the minted API token

Inherited global flags

FlagTypeDefaultDescription
--jsonboolfalseOutput raw JSON
--no-headerboolfalseOmit table headers
--pageint1Page number for list commands (default page size: 50)
--quietboolfalseOnly output IDs
--serverstringhttp://localhost:8181mahresources server URL (env: MAHRESOURCES_URL)

Exit Codes

0 success; 1 error (login failed, network error, or not authenticated)