ShipAny Docs

登录鉴权

ShipAny Next 基于 better-auth + Drizzle 适配器实现鉴权。配置位于 src/core/auth/index.ts,所有请求由 catch-all 路由 /api/auth/[...all] 处理。

以下所有服务商凭证均在 管理后台 → Settings → Auth 中配置(存储于 config 表);同名环境变量可作兜底。

邮箱密码登录

默认开启(email_auth_enabled)。可选开启邮箱验证:

  • 打开 email_verification_enabled,并配置 Resend(resend_api_keyresend_sender_email)
  • 验证链接 24 小时过期;重发限制为 60 秒一次
  • 找回密码邮件同样通过 Resend 发送(链接 1 小时有效)

未开启验证时,用户注册后自动登录。

Google 登录

  1. Google Cloud Console 创建 OAuth 客户端(类型:Web application)
  2. 添加授权回调地址:
https://your-domain.com/api/auth/callback/google
  1. 在管理后台 Settings 填入 google_client_id / google_client_secret
  2. 可选开启 Google One Tap(google_one_tap_enabled)

GitHub 登录

  1. 在 GitHub → Settings → Developer settings 创建 OAuth App
  2. 设置回调地址:
https://your-domain.com/api/auth/callback/github
  1. 在管理后台 Settings 填入 github_client_id / github_client_secret

会话

会话存储在 session 表,以 httpOnly Cookie 形式下发,并记录 ipAddressuserAgentuser 表附带扩展字段:utmSourceiplocale