Build a complete authentication flow with registration, login, logout, token refresh, and password reset.
⏱️ Approximately 60-90 minutes
Create New Project
Project Name: Auth APINote Project Slug
Copy your project slug (e.g., proj_auth_xyz123)
Create a /users endpoint with this schema:
⚠️ Note: In production, you'd never expose the password hash. This is a mock API for frontend development.
Endpoint:
POST /api/proj_auth_xyz/auth/registerRequest Body
Validation Rules
Success Response (201 Created)
Error Response (422 Validation Error)
Endpoint:
POST /api/proj_auth_xyz/auth/loginRequest Body
Success Response (200 OK)
Error Response (401 Unauthorized)
Endpoint:
POST /api/proj_auth_xyz/auth/refreshRequest Body
Success Response (200 OK)
Error Response (401 Unauthorized)
Automatically refresh the access token before it expires, or when you receive a 401 response. This keeps the user logged in seamlessly.
Endpoint:
GET /api/proj_auth_xyz/auth/meRequest Headers
Success Response (200 OK)
Error Response (401 Unauthorized)
Endpoint:
POST /api/proj_auth_xyz/auth/logoutRequest Headers
Request Body (Optional)
Success Response (200 OK)
Client-side: Also clear tokens from local storage/cookies and redirect to login page.
Endpoint:
POST /api/proj_auth_xyz/auth/forgot-passwordRequest Body
Success Response (200 OK)
Security: Always return success even if email doesn't exist (prevents email enumeration attacks).
Endpoint:
POST /api/proj_auth_xyz/auth/reset-passwordRequest Body
Success Response (200 OK)
Error Response (400 Bad Request)
Endpoint:
POST /api/proj_auth_xyz/auth/send-verificationRequest Headers
Success Response (200 OK)
Endpoint:
POST /api/proj_auth_xyz/auth/verify-emailRequest Body
Success Response (200 OK)
You've built a complete authentication system with:
This forms the foundation for secure user management in your applications!