Skip to main content
The CloudThinker CLI signs you in through your browser and stores one credential per workspace, so you never paste an API key. This page covers logging in on a laptop or remote machine, switching workspaces, and authenticating scripts and CI jobs.

Prerequisites

  • The CLI is installed. See CLI overview.
  • A CloudThinker account with access to at least one workspace. A workspace is the project that holds your connections and conversations.

Log in

1

Start the login

On an interactive terminal, the CLI asks How would you like to log in?Use the arrow keys or press 1 or 2, then Enter.
2

Approve in the browser

The CLI prints Open this URL to authorize CloudThinker: with the link and opens it. Press c to copy the link if the browser didn’t open. Sign in, choose the workspace, and approve the request within five minutes.
cloudthinker login printing the consent URL before opening the browser
Success state: the terminal prints Logged in to <workspace>.Picked Log in with a code? Follow Log in on a remote machine instead.
3

Verify the credential

whoami asks the API, not the local file, so it proves the credential works.Success state: one line with host=, email=, and workspace= values. Add --json for machine-readable output.

Log in on a remote machine

Over SSH, or on Linux with no display, the CLI picks the code flow on its own and says so: No local browser detected (SSH session). Using device-code login. It prints a URL with the code already filled in, the code itself, and how long the code stays valid. Open the URL in any browser, on any device, and check that the page shows the same code before you approve.
While it waits, the terminal shows Waiting for approval: … elapsed, code expires in ….

Work with several workspaces

Log in once per workspace. Each login is stored by host and workspace, so logging in to a second workspace keeps the first. --workspace, auth switch, and CLOUDTHINKER_WORKSPACE take a workspace ID or the exact workspace name. Quote names that contain spaces. --workspace goes before the command name:

Use a custom host

To use a host other than https://app.cloudthinker.io, run cloudthinker login --url <origin> once. Later commands remember it. You can also set CLOUDTHINKER_URL. See the CLI reference.

Authenticate a script or CI job

A pipeline has no browser, so it can’t approve a login. Give it a service account token or a personal API token in CLOUDTHINKER_TOKEN instead. See Use CloudThinker in CI/CD.
A runner login acts as the person who logged in, so every job on that runner runs with their access. Prefer a service account token. To revoke it, run cloudthinker logout on the runner.
The token from cloudthinker auth token authenticates as you until it expires. Treat it like a password: never log it, commit it, or paste it into a chat. The token already names its workspace, so every command except review setup and doctor, cloudthinker api included, exits with code 2 when --workspace or CLOUDTHINKER_WORKSPACE is set beside CLOUDTHINKER_TOKEN. Unset CLOUDTHINKER_WORKSPACE before you export the token. An API token (ct_pat_ or ct_sat_) works with cloudthinker chat, cloudthinker incident ls and incident status, the public API commands, and cloudthinker api; most other commands need a login or a token from auth token.

Where credentials live

The CLI writes credentials as plain JSON to one file, readable only by your user (mode 0600). It doesn’t use the OS keychain; releases before 0.5.3 did, and upgrading moves those logins into the file. The file holds every workspace login, keyed by host and workspace.

Log out

Logout asks the server to revoke the credential, then deletes it from the local file. The local copy is removed even if the server can’t be reached. Success state: the terminal prints Logged out., or Logged out of all workspaces for this host.

Troubleshooting

The credential is missing or expired, or the server refused access. Run cloudthinker login again. In a non-interactive shell, the CLI never opens a browser: it prints the login command to run and stops.
The environment token outranks stored credentials, so logging in again or running auth switch changes nothing. Replace the token, or run unset CLOUDTHINKER_TOKEN and use your saved logins.
--workspace matches an exact name or a workspace ID. Run cloudthinker auth status to see your saved workspaces, and quote a name that contains spaces.

Next steps

Headless Chat

Send prompts from scripts and CI with the credential you just set up.

CLI Reference

Every flag, environment variable, and exit code.