Skip to content

sp auth

When agents use this: When SP_TOKEN is unset or expired.

Synopsis

Authenticate and inspect identity.

Subcommands

SubcommandFlagsDescription
login--email, --code, --guest, --no-saveObtain JWT
whoamiCurrent user from token
refresh--user, --no-saveRefresh token

Examples

bash
sp auth login --email ops@corp.com --code 848291 --json
sp auth login --email ops@corp.com --code 848291 --no-save --json
sp auth whoami --json
export SP_TOKEN="$(sp auth login ... --no-save --json | jq -r '.data.token')"

By default, login and refresh save the token to the shared configuration file in ${XDG_CONFIG_HOME:-~/.config}/softprobe/config.jsonc. With --no-save, the token

is returned in JSON only and no config, cache, data, or state file is modified.

JSON output (login)

json
{
  "ok": true,
  "command": "auth login",
  "data": {
    "token": "eyJ...",
    "userName": "ops@corp.com",
    "expiresAt": "2026-05-19T12:00:00Z"
  }
}

REST mapping

SubcommandMethodPath
login (email)POST/api/login/verify
login (guest)POST/api/login/loginAsGuest
refreshGET/api/login/refresh/{userName}
whoamiJWT decode locally, or future profile API

Request body for verify: VerifyRequestType (userName, verifyCode, …).

Replaces

None (new). CI uses SP_TOKEN directly.

零代码改动 · 全上下文可见性 · 成本优化