leapcat-auth
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseLeapCat Authentication Skill
LeapCat 认证 Skill
Manage user authentication for the leapcat. Handles login, logout, session management, token refresh, re-authentication, and trade password operations.
为Leapcat管理用户认证,可处理登录、登出、会话管理、token刷新、重新认证以及交易密码相关操作。
Prerequisites
前置条件
- Node.js 18+ is required (commands use which auto-downloads the CLI)
npx leapcat@latest - A valid email address registered with LeapCat
- 需要Node.js 18及以上版本(命令使用会自动下载CLI)
npx leapcat@latest - 已在LeapCat注册的有效邮箱地址
Commands
命令
auth login (non-interactive, two-step flow)
auth login(非交互式,两步流程)
Step 1 — Send OTP to email:
bash
npx leapcat@latest auth login --email <email> --send-only --jsonResponse:
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> --jsonParameters:
- — User email address (required)
--email <email> - — Only send the OTP, do not attempt verification
--send-only - — OTP identifier returned from step 1
--otp-id <id> - — 6-digit code the user received via email
--otp-code <code> - — Output in JSON format (always use for agent consumption)
--json
步骤1 — 向邮箱发送OTP:
bash
npx leapcat@latest auth login --email <email> --send-only --json响应:
json
{ "otp_id": "<otp-id-string>" }步骤2 — 验证OTP并完成登录:
bash
npx leapcat@latest auth login --email <email> --otp-id <otp-id> --otp-code <code> --json参数:
- — 用户邮箱地址(必填)
--email <email> - — 仅发送OTP,不执行验证
--send-only - — 步骤1返回的OTP标识符
--otp-id <id> - — 用户通过邮箱收到的6位验证码
--otp-code <code> - — 以JSON格式输出(供Agent调用时请始终使用该参数)
--json
auth logout
auth logout
End the current session and clear stored credentials.
bash
npx leapcat@latest auth logout --json结束当前会话并清除存储的凭证。
bash
npx leapcat@latest auth logout --jsonauth status
auth status
Check if the user is currently authenticated and whether the token is still valid.
bash
npx leapcat@latest auth status --json检查用户当前是否已认证,以及token是否仍有效。
bash
npx leapcat@latest auth status --jsonauth refresh
auth refresh
Refresh the current authentication token before it expires.
bash
npx leapcat@latest auth refresh --json在当前认证token过期前进行刷新。
bash
npx leapcat@latest auth refresh --jsonauth reauth
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执行重新认证以获取更高权限的会话(例如需要Turnkey会话的提现操作场景)。
bash
npx leapcat@latest auth reauth --jsonauth trade-password set
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首次设置交易密码,下单或申购IPO前必须完成该操作。
bash
npx leapcat@latest auth trade-password set --jsonauth trade-password verify
auth trade-password verify
Verify the trade password.
bash
npx leapcat@latest auth trade-password verify --json验证交易密码。
bash
npx leapcat@latest auth trade-password verify --jsonauth trade-password reset
auth trade-password reset
Reset a forgotten trade password.
bash
npx leapcat@latest auth trade-password reset --json重置遗忘的交易密码。
bash
npx leapcat@latest auth trade-password reset --jsonauth trade-password status
auth trade-password status
Check whether a trade password has been set.
bash
npx leapcat@latest auth trade-password status --json检查是否已设置交易密码。
bash
npx leapcat@latest auth trade-password status --jsonWorkflow
工作流程
- Check auth status — Run to determine if the user is already logged in.
auth status --json - Login if needed — If not authenticated, execute the two-step login flow:
- Send OTP with
--send-only - Ask the user for the OTP code they received
- Complete login with and
--otp-id--otp-code
- Send OTP with
- Refresh when expired — If a command returns a 401/token-expired error, run . If refresh fails, re-run the full login flow.
auth refresh --json - Re-auth for sensitive operations — Before wallet withdrawals or other sensitive actions, run to elevate the session.
auth reauth --json
- 检查认证状态 — 运行确认用户是否已登录。
auth status --json - 如有需要执行登录 — 若未认证,执行两步登录流程:
- 携带参数发送OTP
--send-only - 向用户询问其收到的OTP验证码
- 携带和
--otp-id参数完成登录--otp-code
- 携带
- 过期时刷新 — 若命令返回401/token-expired错误,运行。如果刷新失败,重新执行完整登录流程。
auth refresh --json - 敏感操作前重新认证 — 在钱包提现或其他敏感操作前,运行提升会话权限。
auth reauth --json
Error Handling
错误处理
| Error | Cause | Resolution |
|---|---|---|
| OTP code timed out | Re-send OTP with |
| Wrong OTP code entered | Ask the user to double-check the code and retry |
| Auth token has expired | Run |
| No active session | Run the full login flow |
| Trade password required but not set | Run |
| 错误 | 原因 | 解决方案 |
|---|---|---|
| OTP验证码超时 | 携带 |
| 输入的OTP验证码错误 | 请用户核对验证码后重试 |
| 认证token已过期 | 运行 |
| 无活跃会话 | 执行完整登录流程 |
| 需要交易密码但尚未设置 | 运行 |