Skip to main content

Session status

GET /api/auth

  • Auth – optional.
  • Response{ status: "ok" | "email_not_verified" | "2fa_required", auth } where auth echoes the JWT payload or null.
Use this endpoint to decide whether the user must verify email or pass 2FA before granting UI access.

Account lifecycle

Email verification

Password reset

Two-factor authentication (TOTP)

All endpoints require an email-verified session.
  • POST /api/auth/2fa/enable/request{ status: "2fa_setup", url, secret }. url is a TOTP URI you can render as a QR code.
  • POST /api/auth/2fa/enable/submit with { token } confirms setup and issues a fresh cookie.
  • POST /api/auth/2fa/verify with { token } completes login when status === "2fa_required".
  • POST /api/auth/2fa/reset with { token } rotates the 2FA secret and re-enters the "2fa_setup" state.

External providers

All external flows set or clear the openid_code and openid_state cookies automatically. After a successful redirect, the user is taken to /dashboard unless you specify a different returnUrl inside your email templates.