Email/password authentication is the traditional flow: a user registers with an email and password, confirms their email, and signs in to receive HTTP-only session cookies.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.
Signup flow
Submit signup request
The client sends a
POST /api/v1/auth/signup request with a valid email and a password that meets all requirements.Validate input
The server runs Zod validation against the request body. If any field fails, a
400 error is returned before touching Supabase.Create user in Supabase
supabase.auth.signUp() is called with the email, password, and a emailRedirectTo pointing to FRONTEND_URL/auth/callback.Email confirmation
When email confirmation is enabled in your Supabase project, Supabase sends a confirmation email and returns
session: null. The API responds with 201 and a user object but no tokens.When email confirmation is disabled, a full session is returned immediately and tokens are included in the response.Password requirements
Passwords are validated bysignupSchema in src/schemas/auth.schemas.ts. All four rules must pass:
| Rule | Requirement |
|---|---|
| Minimum length | At least 8 characters |
| Uppercase letter | At least one A–Z character |
| Lowercase letter | At least one a–z character |
| Number | At least one 0–9 digit |
Signup request
curl
Signup response — email confirmation required
When email confirmation is required,
tokens fields will be null. The user must click the confirmation link in their email before they can log in.Signup response — email confirmation disabled
Login flow
Authenticate with Supabase
supabase.auth.signInWithPassword() is called. If the credentials are wrong or the user does not exist, Supabase returns an error.Tokens written to cookies
On success the controller writes two HTTP-only cookies:
accessToken— expires based onexpiresInreturned by Supabase (typically 1 hour)refreshToken— expires in 7 days
httpOnly: true, sameSite: strict, and secure: true in production.Login request
curl
Login response
Error cases
| Scenario | HTTP status | Error message |
|---|---|---|
| Invalid email format | 400 | Invalid email address |
| Password too short | 400 | Password must be at least 8 characters |
| Password missing uppercase | 400 | Password must contain at least one uppercase letter |
| Password missing lowercase | 400 | Password must contain at least one lowercase letter |
| Password missing number | 400 | Password must contain at least one number |
| Email already registered | 409 | Email already registered |
| Wrong credentials | 401 | Invalid email or password |
| Email not confirmed | 401 | Invalid email or password |