Skip to main content

workspace login

workspace login will initiate a device flow login request to Workflow 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. It no longer reuses the Desktop configuration file, nor does it require the token to be entered manually.

Command Format

pnpm exec workflow-code workspace login --server <url>

Parameter

ParameterDescription
--server <url>Required. Workflow Server address.

Verification method

StepsDescription
Create Device CodeCLI calls POST /api/auth/device/start.
Open the browserAutomatically open verificationUriComplete; output URL and user code without browser.
Polling ResultsCLI polls POST /api/auth/device/token until successful, denied, expired, or throttled.
Write ConfigurationAfter success, write to workflow-auth.json, and save the server, API key, expiration time, and user information.

Configuration file

ConfigurationDescription
File nameworkflow-auth.json
macOS Default Directory~/Library/Application Support/workflow-code
Windows Default Directory%APPDATA%/workflow-code
Linux Default Directory$XDG_CONFIG_HOME/workflow-code or ~/.config/workflow-code
Custom CatalogSettings WORKFLOW_CLI_AUTH_DIR

Output

SituationOutput
Login successful{ errCode: 0, errMessage: "", data: { loggedIn: true, serverUrl, user, expiresAt, apiKeyPrefix } }
Authorization denied or expiredOutput the error response returned by the server with the exit code 1.
Parameter missingOutput error message with exit code 1.

Example

pnpm exec workflow-code workspace login --server http://localhost:7125
GoalCommand
View login statusstatus
Clear Logon Statuslogout
Check Service Healthhealth