Manage authentication for Treasure AI. Supports both browser-based OAuth and API key authentication.
tdx auth # Show authentication status
tdx auth status # Alias for tdx auth
tdx auth setup # Setup authentication interactively
tdx auth token # Print the OAuth access token
tdx auth clear # Remove credentials from system keychainDisplay current authentication status and validate credentials:
tdx auth
tdx auth --profile prodShows the active profile, credential type (OAuth or API key), and validates by calling the TD API.
Interactive authentication setup. Choose between browser-based OAuth (recommended) or API key:
tdx auth setup
tdx auth setup --site ap01
tdx auth setup --profile prod
tdx auth setup --account-name td7060 # SSO login for a specific account- Select your Treasure AI site
- Choose "Sign in with browser"
- Optionally enter an account name for SSO routing
- Browser opens for authentication
- After login, tokens are saved to system keychain
OAuth tokens are stored securely in the system keychain and used automatically for subsequent commands.
OAuth opens a local callback server on 127.0.0.1:43594 to receive the authorization response. The server times out after 2 minutes.
- Select your Treasure AI site
- Choose "Use an API key"
- Enter your API key (found at Console > API Keys)
- Key is validated and saved to system keychain
tdx auth token prints only the raw OAuth access token followed by a newline. It is intended for tools that support command-based bearer authentication, such as Codex. The command does not print status messages on stdout; errors are written to stderr.
tdx auth token
tdx auth token --profile productionThe command reads profile-specific environment tokens before keychain credentials. Keychain OAuth credentials are refreshed when they are expired or within five minutes of expiry, and refreshed credentials are saved back to the system keychain. API keys are not printed or treated as bearer tokens.
In the rare case that the stored token is known-expired and the keychain has no refresh token to renew it with — a corrupted or partially initialized entry — the command exits non-zero with UNAUTHENTICATED instead of printing a stale bearer, and points you at tdx auth setup. This is not something a normal tdx auth setup flow leaves behind. Legacy keychain entries written before token-expiry tracking existed are accepted as-is.
Remove all credentials (API key and OAuth tokens) from the system keychain:
tdx auth clear
tdx auth clear --profile prod| Option | Description |
|---|---|
--site <site> | Target site (us01, ap01, eu01, ap02) |
--profile <name> | Profile to use |
--account-name <name> | Account name for SSO login (auth setup only) |
| Variable | Description |
|---|---|
TDX_ACCESS_TOKEN | Access token for Bearer authentication |
TDX_ACCESS_TOKEN_<PROFILE> | Profile-specific access token |
TDX_ACCESS_TOKEN_FILE | File containing an access token |
TDX_API_KEY | API key for TD1 authentication |
TDX_API_KEY_<PROFILE> | Profile-specific API key |
TD_OAUTH_CLIENT_ID | Override OAuth client ID (default: tdx) |