Arkloop Developers

认证 (Auth)

获取 Captcha 配置

GET /v1/auth/captcha-config

无需认证。返回 Cloudflare Turnstile 站点配置(前端渲染 captcha 时使用)。

响应

{
  "enabled": true,
  "site_key": "0x..."
}

检查用户是否存在

POST /v1/auth/check

请求体

字段类型说明
loginstring用户名或邮箱

响应

{
  "exists": true
}

注册模式查询

GET /v1/auth/registration-mode

响应

{
  "mode": "open"
}

mode 取值:open(开放)、invite_only(仅邀请)、disabled(关闭)。


注册

POST /v1/auth/register

请求体

字段类型必填说明
loginstring用户名
passwordstring密码
emailstring邮箱
invite_codestring条件邀请制模式下必填
localestring语言偏好
cf_turnstile_tokenstring条件启用 Turnstile 时必填

响应

{
  "user_id": "...",
  "access_token": "...",
  "token_type": "bearer",
  "warning": null
}

成功时服务端会通过 Set-Cookie 下发 Refresh Token(HttpOnly Cookie:arkloop_refresh_token)。


登录

POST /v1/auth/login

请求体

字段类型必填说明
loginstring用户名或邮箱
passwordstring密码
cf_turnstile_tokenstring条件启用 Turnstile 时必填

响应

{
  "access_token": "...",
  "token_type": "bearer"
}

成功时服务端会通过 Set-Cookie 下发 Refresh Token(HttpOnly Cookie:arkloop_refresh_token)。


刷新 Token

POST /v1/auth/refresh

说明

无需请求体。服务端从 HttpOnly Cookie arkloop_refresh_token 读取 Refresh Token 并轮换。

响应 — 同登录响应格式(仅含 access_tokentoken_type),同时会更新 Refresh Token Cookie。


登出

POST /v1/auth/logout

需携带 Bearer Token。使当前 Token 失效,并清理 Refresh Token Cookie。

响应

{ "ok": true }

邮箱验证 — 发送验证邮件

POST /v1/auth/email/verify/send

无请求体,使用当前登录用户的邮箱。


邮箱验证 — 确认

POST /v1/auth/email/verify/confirm

请求体

字段类型必填
tokenstring

邮箱 OTP 登录 — 发送 OTP

POST /v1/auth/email/otp/send

请求体

字段类型必填说明
emailstring目标邮箱
cf_turnstile_tokenstring条件

邮箱 OTP 登录 — 验证 OTP

POST /v1/auth/email/otp/verify

请求体

字段类型必填
emailstring
otpstring

响应 — 同登录响应格式(含 access_tokentoken_type),同时会更新 Refresh Token Cookie。

On this page