Skip to main content
The truss auth command group manages how the Truss CLI authenticates with a Baseten remote. Use it to log in with an API key or through browser-based OAuth, view the active credential for a remote, and log out.

Authentication methods

Choose how Truss authenticates with Baseten.
  • Workload identity federation: configure a trust rule and supply a workload identity token through the environment. Truss exchanges it for a short-lived access token and refreshes the access token before it expires.
  • API key: paste an API key.
  • Browser (OAuth): complete an OAuth 2.0 device flow by approving the request in your browser. The CLI attempts to open your browser automatically and prints the verification URL and code as a fallback. Best for laptops where you don’t want a stored secret on disk.
OAuth tokens refresh automatically before each request, so you don’t have to re-authenticate while the refresh token is valid.

Where credentials are stored

Truss stores API keys in plaintext in ~/.trussrc to support SSH proxy commands. OAuth tokens are stored in your operating system’s keyring under the service name baseten-truss whenever a usable backend is available (macOS Keychain, GNOME Keyring, and Windows Credential Manager). If no keyring backend is available (for example, a headless Linux container), Truss falls back to writing the OAuth token inline to ~/.trussrc and prints a one-line warning. To force the inline path silently, set BASETEN_TRUSS_AUTH_KEYRING_DISABLED=1.
On macOS, the first read or write triggers a one-time Keychain prompt. Choose Always Allow to make subsequent calls silent.
Existing plaintext [remote] api_key = ... entries in ~/.trussrc continue to work without changes; there’s no auto-migration.

Remotes

A remote is a named entry in ~/.trussrc that points at a Baseten workspace and stores its credential. The default remote is baseten. You can configure additional remotes (for staging environments, multiple workspaces, and so on) and select one with --remote on most CLI commands. truss auth status and truss auth logout both accept --remote NAME. When only one remote is configured, the flag is optional.

login

Log in to a Baseten remote.
With no flags, the command prompts you to choose between pasting an API key and logging in through your browser. In non-interactive contexts, pass --browser or --api-key explicitly. truss login is an alias and accepts the same flags.

Options

Log in through your browser using the OAuth device flow. Mutually exclusive with --api-key.
TEXT
Authenticate with a Baseten API key. Mutually exclusive with --browser.
TEXT
Name of the remote to create or update in ~/.trussrc. Defaults to baseten.
humanfriendly | W | WARNING | I | INFO | D | DEBUG
default:"humanfriendly"
Logging verbosity. humanfriendly (default) is pretty-printed; INFO, DEBUG, WARNING produce structured logs.
Disable interactive prompts. Use in CI/automated contexts where stdin isn’t a TTY.

Examples

Log in interactively and choose a method when prompted:
You should see:
Log in non-interactively with an API key:
Log in through your browser:
The CLI opens your browser to the verification page with your user code pre-filled. Approve the request, and the CLI automatically stores the OAuth tokens and prints:
Add a non-default remote (for example, a staging workspace):

logout

Log out of a Baseten remote and remove it from ~/.trussrc. For OAuth remotes, this also revokes the refresh token on the backend.

Options

TEXT
Remote name to log out of. Inferred when only one remote is configured.
humanfriendly | W | WARNING | I | INFO | D | DEBUG
default:"humanfriendly"
Logging verbosity. humanfriendly (default) is pretty-printed; INFO, DEBUG, WARNING produce structured logs.
Disable interactive prompts. Use in CI/automated contexts where stdin isn’t a TTY.

Examples

Log out of the only configured remote:
Log out of a specific remote:
You should see:

status

Show the active authentication for a remote: the URL it points at, which method it uses, and where the credential is stored.

Options

TEXT
Remote name to inspect. Inferred when only one remote is configured.
humanfriendly | W | WARNING | I | INFO | D | DEBUG
default:"humanfriendly"
Logging verbosity. humanfriendly (default) is pretty-printed; INFO, DEBUG, WARNING produce structured logs.
Disable interactive prompts. Use in CI/automated contexts where stdin isn’t a TTY.

Examples

Inspect a remote:
You should see:
For a stored credential, source shows where Truss reads it:
  • keyring: the credential is stored in the OS keyring.
  • trussrc-inline: the credential is stored as plaintext inside ~/.trussrc.
For workload identity, auth_type is workload_identity. Truss shows the trust rule ID and token source without displaying the token.

Environment variables

For workload identity federation, set the trust rule ID and exactly one token source. Leave BASETEN_API_KEY and BASETEN_TRUSS_AUTH_API_KEY unset. Workload identity takes precedence over stored credentials. To run without a configured remote, also set BASETEN_TRUSS_AUTH_REMOTE_URL=https://app.baseten.co.
TEXT
ID of the trust rule the workload uses to exchange its identity token for a Baseten access token.
PATH
Path to the file containing your platform’s identity token. Truss rereads the file on each exchange so your platform can rotate the token during long-running jobs.
TEXT
Your platform’s identity token, supplied directly. Use a token file when the process can outlive the token.
TEXT
API key used as a fallback when the active remote has no credentials in ~/.trussrc. Recommended for CI/CD, where setting the env var avoids running truss login before each job.
FLAG
Set to 1 to skip the OS keyring and write credentials inline to ~/.trussrc without printing a warning. Useful in containers and headless environments where no keyring backend is available.