ChartnautDocs

Sign in

chartnaut login connects the CLI to your Chartnaut account through your browser. You approve it once per computer, and the CLI stays signed in until you sign out or revoke its key.

Your account needs Starter or above. Plans

Sign in

Run chartnaut login. It prints a code and opens your browser:

$ chartnaut login
Opening your browser… (or go to https://terminal.chartnaut.com/morpheus/cli-auth?code=KTRW-BHXM)
Code: KTRW-BHXM
  1. In the browser, check that the code on the page matches the one in your terminal. The page also shows your computer's name.

  2. Click Connect. If you are signed out of Chartnaut, sign in first and the page comes back.

  3. The page reads Connected. You can close this tab., and the terminal finishes:

Signed in as jane.
Screenshot to capture · 4:3 · cli-sign-in-connect
The Connect the Chartnaut CLI approval page with the computer's name, the code, Connect and Cancel
Route/morpheus/cli-auth?code=<code printed by chartnaut login>
FocusThe centred approval panel: the heading Connect the Chartnaut CLI, the line with the computer's name and the code, and the Connect and Cancel buttons
StateA pending sign-in: run chartnaut login on a test machine so the code is live (it expires after 10 minutes). Do not click Connect on the capture account unless the key it creates is revoked afterwards
Sourceclient/src/routes/authenticated/morpheus/settings/ApiTokens/CliAuthPage.tsx:17 CliAuthPage
The approval page, showing the computer's name and the code.

The code works for 10 minutes. Cancel on the page stops the sign-in, and the terminal prints Sign-in cancelled.

Connect only a code you started yourself. Anyone who gets you to click Connect on their code gets a terminal signed in to your account.

Check who you are signed in as

$ chartnaut whoami
user:   jane
plan:   starter
token:  CLI on Janes-MacBook-Pro.local
scopes: scripts:read scripts:write runs:write
api:    https://api.chartnaut.com/v1

What signing in creates

Signing in creates an API key named CLI on followed by your computer's name. It has every scope and no expiry date. It is listed with your other keys on the Developers page, in the menu under your name, and revoking it there signs that computer out.

The CLI saves the key in ~/.config/chartnaut/credentials.json, readable only by you. Your own program can sign in the same way with Start a sign-in and Poll a sign-in. On Windows the folder is under your user folder, %USERPROFILE%\.config\chartnaut.

Sign in on a server or over SSH

chartnaut login --no-browser prints the link instead of opening a browser. Open it on any device where you are signed in to Chartnaut, such as your phone, and click Connect. The terminal finishes on its own.

Use a key you already have

For CI or a machine you cannot approve from, make a key under Developers with Create API key, then either save it:

chartnaut login --token cn_live_…

or set it in the environment. CHARTNAUT_TOKEN overrides the saved key for every command:

export CHARTNAUT_TOKEN=cn_live_…

With CHARTNAUT_TOKEN set, login and logout still change the saved key, and each prints a reminder that the variable is still set and wins. API keys

Switch account or sign in again

chartnaut login on a computer that is already signed in stops there:

Already signed in as jane. Use --force to switch.

chartnaut login --force signs in again. Once the new sign-in works, the CLI revokes the key it used before, so you are not left with an old key that still works. If the saved key was already revoked or has expired, a plain chartnaut login signs you in again without --force.

Sign out

$ chartnaut logout
Signed out.

logout revokes this computer's key on Chartnaut and deletes the saved copy. If Chartnaut cannot be reached, it deletes the copy and prints Signed out here. Revoke the key in Settings → Developers to finish. Do that on the Developers page.

When sign-in does not work

You see

Cause

What to do

API access is included on Starter and above. on the approval page

Your account is on Free.

Upgrade, then run chartnaut login again. Plans

This code has expired. on the page, or The code expired. in the terminal

More than 10 minutes passed.

Run chartnaut login again.

error: unauthorized: not logged in. on any command

This computer has no saved key and CHARTNAUT_TOKEN is not set.

Run chartnaut login.

plan_limit on every command after signing in

The account moved to Free, so its keys stop working.

Upgrade. The same key works again.

All of these exit with code 3. Errors and exit codes