Skip to main content
The magnet login command authenticates the CLI as your Magnet user. It opens your browser to a confirmation page, and once you approve the displayed code, stores a personal CLI token on your machine (in ~/.magnet/auth.json, scoped to the API base URL).

Usage

magnet login
  Confirm code 4JLC-LPQ6 to log in.

  Opening https://www.magnet.run/cli/verify?code=4JLC-LPQ6 ...
Logged in as you@example.com
If the browser can’t be opened (for example over SSH), the CLI prints the verification URL and code so you can complete the approval from any device.

Options

OptionDescription
--token <token>Use an existing CLI token instead of the browser flow.
--no-browserDon’t open a browser; print the verification URL and code instead.

Examples

Log in on a headless machine:
magnet login --no-browser
Reuse a token issued elsewhere (for example, provisioning a container):
magnet login --token mgcli_xxxxxxxx
  • magnet whoami — check who you’re logged in as
  • magnet logout — revoke the stored token
  • Tokens can also be reviewed and revoked from your Magnet account settings.