auth login signs you in to OnTrack and keeps the session on your machine, encrypted. In a terminal it asks which way to sign in; a script or agent gets the CLI browser.
Tick “Remember me” on your institution’s sign-in page. OnTrack issues the renewal credential only for remembered sign-ins, and ontrack needs it to renew your session without asking you again.

Choose a sign-in path

Paste credentials

In your browser’s DevTools Network tab, find the request to OnTrack named access-token. Copy its Cookie header, the whole request as cURL, or its response, then run ontrack auth login --paste and paste it. Multi-line pastes stay together. A bare renewal cookie also needs --username USERNAME. A script can pipe the same text to ontrack auth login --paste on stdin. Keep credentials out of command arguments, where your shell history would keep them.
The DevTools snippet is generated for one sign-in attempt and works only for that attempt. Don’t reuse one from an old terminal or share it; treat it like a password-reset link.

How the session stays signed in

When the access token expires, ontrack renews it with the renewal credential, then, if that fails, by signing in again in the private browser profile in the background, which prints one line on stderr. Renewal must return the same account; to switch accounts, run auth login. The renewal credential itself expires, and renewing does not extend it. Signing in again does: run auth login, or sign in to OnTrack in your everyday browser and ontrack picks up the newer credential from there when the stored one is close to expiring. In its last 24 hours, ordinary commands print one reminder on stderr, never in JSON output. If your institution’s sign-in needs multi-factor authentication, no unattended job can do this for you: sign in again before the reminder’s deadline. If both the renewal credential and your institution’s sign-in have expired, run auth login again.

Where the session lives

The session is encrypted in ~/.config/ontrack-cli/session.json, readable only by you, with its key in macOS Keychain, Windows’ data protection or the Linux Secret Service. On Linux without a Secret Service, the key is a private file under ~/.config/ontrack-cli/keys/, protected only by your file permissions. The private browser profile lives under ~/.config/ontrack-cli/browser/, one per site. Credentials supplied through environment variables or the config file are never written to the session file, and they take precedence over it. See OnTrack CLI for scripts and agents for that route.

Check, renew and sign out

auth status checks the session against OnTrack and reports your username, the site’s sign-in method and how many units and teaching roles you have. --local reads only the cache, without a network request, and shows renewal_expires_at. auth renew (also auth keepalive) renews and verifies once without an interactive sign-in. auth logout ends the session on OnTrack when it can, then deletes the session file and the private browser profiles; it still signs you out locally if OnTrack can’t be reached. When sign-in or access fails, run ontrack doctor. See Troubleshooting.

First run at a terminal

The first time you run any command with no site configured, ontrack asks for your OnTrack URL once and saves it to the config file. If it then finds no session, it offers to run auth login for you. Both prompts are skipped for a non-interactive caller. See Install and Humans and agents.