Signing in
Every login targets one environment. Pass the environment as a flag, or run the command without one in a terminal and the CLI will ask:- Sandbox
- Production
Terminal
--new-session.
After signing in, the CLI lists every organization you can access across the
environments you are signed in to and asks which one to make active.
The active organization
Commands that act on an organization, such aspolar listen, use the active
organization. Its environment comes with it: choosing a sandbox organization
means the CLI talks to sandbox, choosing a production organization means it
talks to production. There is no separate environment switch.
Terminal
Terminal
Terminal
Terminal
Signing out
Log out of one environment or all of them:Terminal
CI and headless use
On machines without a browser or keychain, authenticate with an organization access token instead of a session:Terminal
POLAR_ENVIRONMENT selects the environment the token belongs to and defaults
to production. When a token can access several organizations, pass
--org <organization-id> to the command.
While
POLAR_ACCESS_TOKEN is set, saved sessions are ignored and polar auth login and polar auth org refuse to run. Unset it to go back to your
browser session.Where things are stored
- Sessions live in the operating system keychain under the service name
polar-cli, with one entry per environment. - The active organization is saved in
~/.config/polar-cli/config.json, or$XDG_CONFIG_HOME/polar-cli/config.jsonwhen that variable is set.

