OTP login is a two-step, passwordless flow. The user provides their email, receives a six-digit code from Supabase, and submits that code to get a full session.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/eggarcia98/auth-backend/llms.txt
Use this file to discover all available pages before exploring further.
How it works
Request an OTP
The client posts the user’s email to
POST /api/v1/auth/login/otp. The server calls supabase.auth.signInWithOtp() which triggers Supabase to deliver a time-limited one-time password to that address.User receives the email
Supabase sends the OTP code directly to the user’s inbox. The code is valid for a short window (typically 10 minutes, configurable in your Supabase project settings).
Verify the OTP
The client submits both the email and the OTP code to
POST /api/v1/auth/verify-otp. The server calls supabase.auth.verifyOtp() with type: "email".Unlike email/password login, OTP verification returns the tokens directly in the response body rather than setting cookies. Store and send them according to your frontend strategy — see Token Management for guidance.
Step 1 — Request OTP
Request
curl
Request body
| Field | Type | Required | Description |
|---|---|---|---|
email | string | Yes | Valid email address to send the OTP to |
Response
The API always returns
success: true for a valid email address, even if the address is not registered. This prevents user enumeration.Step 2 — Verify OTP
Request
curl
Request body
| Field | Type | Required | Description |
|---|---|---|---|
email | string | Yes | The same email used in step 1 |
token | string | Yes | The OTP code from the email |
Response — success
Error cases
| Scenario | HTTP status | Error message |
|---|---|---|
| Missing or invalid email | 400 | Invalid email address |
| OTP code expired | 401 | Invalid or expired OTP |
| OTP code incorrect | 401 | Invalid or expired OTP |
| Email/token mismatch | 401 | Invalid or expired OTP |
Error response
Frontend integration
TypeScript