LeapCat Authentication Skill
Manage user authentication for the leapcat. Handles login, logout, session management, token refresh, re-authentication, and trade password operations.
Prerequisites
- Node.js 18+ is required (commands use which auto-downloads the CLI)
- A valid email address registered with LeapCat
Commands
auth login (non-interactive, two-step flow)
Step 1 — Send OTP to email:
bash
npx leapcat@latest auth login --email <email> --send-only --json
Response:
json
{ "otp_id": "<otp-id-string>" }
Step 2 — Verify OTP and complete login:
bash
npx leapcat@latest auth login --email <email> --otp-id <otp-id> --otp-code <code> --json
Parameters:
- — User email address (required)
- — Only send the OTP, do not attempt verification
- — OTP identifier returned from step 1
- — 6-digit code the user received via email
- — Output in JSON format (always use for agent consumption)
auth logout
End the current session and clear stored credentials.
bash
npx leapcat@latest auth logout --json
auth status
Check if the user is currently authenticated and whether the token is still valid.
bash
npx leapcat@latest auth status --json
auth refresh
Refresh the current authentication token before it expires.
bash
npx leapcat@latest auth refresh --json
auth reauth
Perform a re-authentication to obtain an elevated session (e.g., for withdrawal operations that require a Turnkey session).
bash
npx leapcat@latest auth reauth --json
auth trade-password set
Set the trade password for the first time. Required before placing orders or subscribing to IPOs.
bash
npx leapcat@latest auth trade-password set --json
auth trade-password verify
Verify the trade password.
bash
npx leapcat@latest auth trade-password verify --json
auth trade-password reset
Reset a forgotten trade password.
bash
npx leapcat@latest auth trade-password reset --json
auth trade-password status
Check whether a trade password has been set.
bash
npx leapcat@latest auth trade-password status --json
Workflow
- Check auth status — Run to determine if the user is already logged in.
- Login if needed — If not authenticated, execute the two-step login flow:
- Send OTP with
- Ask the user for the OTP code they received
- Complete login with and
- Refresh when expired — If a command returns a 401/token-expired error, run . If refresh fails, re-run the full login flow.
- Re-auth for sensitive operations — Before wallet withdrawals or other sensitive actions, run to elevate the session.
Error Handling
| Error | Cause | Resolution |
|---|
| OTP code timed out | Re-send OTP with and retry |
| Wrong OTP code entered | Ask the user to double-check the code and retry |
| Auth token has expired | Run ; if that fails, login again |
| No active session | Run the full login flow |
| Trade password required but not set | Run auth trade-password set --json
|