workspace login
workspace login will initiate a device flow login request to SteamHarness Server, open the browser authorization page, and wait for the user to write the CLI dedicated API Key to the local workflow-auth.json after approval on the Web side. The CLI saves its own credentials and does not require manual token entry.
Command Format
pnpm exec steamharness workspace login --server <url>
Parameter
| Parameter | Description |
|---|---|
--server <url> | Required. SteamHarness Server address. |
Verification method
| Steps | Description |
|---|---|
| Create Device Code | CLI calls POST /api/auth/device/start. |
| Open the browser | Automatically open verificationUriComplete; output URL and user code without browser. |
| Polling Results | CLI polls POST /api/auth/device/token until successful, denied, expired, or throttled. |
| Write Configuration | After success, write to workflow-auth.json, and save the server, API key, expiration time, and user information. |
Configuration file
| Configuration | Description |
|---|---|
| File name | workflow-auth.json |
| macOS Default Directory | ~/Library/Application Support/steamharness |
| Windows Default Directory | %APPDATA%/steamharness |
| Linux Default Directory | $XDG_CONFIG_HOME/steamharness or ~/.config/steamharness |
| Custom Catalog | Settings STEAMHARNESS_CLI_AUTH_DIR |
Output
| Situation | Output |
|---|---|
| Login successful | { errCode: 0, errMessage: "", data: { loggedIn: true, serverUrl, user, expiresAt, apiKeyPrefix } } |
| Authorization denied or expired | Output the error response returned by the server with the exit code 1. |
| Parameter missing | Output error message with exit code 1. |
Example
pnpm exec steamharness workspace login --server http://localhost:7126
Related Commands
| Goal | Command |
|---|---|
| View login status | status |
| Clear Logon Status | logout |
| Check Service Health | health |