Authentication
OTP auth sends a numeric email code, stores only a hash of the code, verifies one-time use, and creates a session on success.
Configuration
Routes
Send Code
POST /api/auth/otp/send
Response:
Verify Code
POST /api/auth/otp/verify
On success, BolkAuth creates or updates the user, marks the email as verified, creates a session, and sets the session cookie.
React Hook
Error Codes
| Code | Cause |
|---|---|
invalid_email | The send-code request did not include a valid email. |
otp_not_configured | email.sendOTP is missing. |
invalid_otp | The submitted code is malformed, expired, already used, or incorrect. |