Auth

Authentication and session management. SpeyBooks uses JWT-based authentication with optional TOTP two-factor.

Login flow

  1. POST /auth/login with username/password
  2. If TOTP enabled: returns tempTokenPOST /auth/totp/verify
  3. Returns accessToken (15min) and refreshToken (7 days)
  4. Refresh via POST /auth/refresh before access token expires

Security features

  • Passwords hashed with Argon2id (65536 KiB, 3 iterations)
  • Account lockout after 5 failed attempts (15 minutes)
  • Token generation tracking — password changes invalidate all refresh tokens
  • TOTP uses RFC 6238 (Google Authenticator compatible)
  • Rate limiting on all public auth endpoints
  • Constant-time responses to prevent user enumeration

Endpoints