Skip to content

sp auth

Phase: v1
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--userRefresh token

Examples

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

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.