Backend API
Authentication
Authentication endpoints, JWT tokens, and session management
Overview
The authentication system uses JWT (JSON Web Tokens) for stateless authentication with access and refresh token patterns.
Auth Endpoints
| Method | Endpoint | Description |
|---|---|---|
| POST | /auth/login | Login with email/password |
| POST | /auth/signup | Register new user |
| POST | /auth/logout | Logout current user |
| POST | /auth/forgot-password | Request password reset |
| POST | /auth/reset-password | Reset password with token |
| POST | /auth/refresh | Refresh access token |
| POST | /auth/verify-email | Verify email address |
| GET | /auth/me | Get current user |
Login
Authenticate a user with email and password.
Request
Response
Error Responses
Signup
Register a new user account.
Request
Response
Validation Rules
| Field | Rules |
|---|---|
email | Required, valid email format, max 254 chars |
password | Required, min 8 chars, uppercase, lowercase, number, special char |
firstName | Required, 2-50 chars, letters only |
lastName | Required, 2-50 chars, letters only |
role | Required, one of: employer, talent |
agreeToTerms | Required, must be true |
Forgot Password
Request a password reset email.
Request
Response
Reset Password
Reset password using the token from email.
Request
Response
Refresh Token
Get a new access token using the refresh token.
Request
Response
Get Current User
Get the authenticated user's profile.
Request
Response
Verify Email
Verify email address with token from email.
Request
Response
Token Management
Access Token
- Short-lived (default: 7 days)
- Sent in
Authorizationheader - Used for API authentication
Refresh Token
- Long-lived (default: 30 days)
- Used to obtain new access tokens
- Should be stored securely
Token Storage (Frontend)
Security Considerations
- HTTPS Only - All auth endpoints should use HTTPS in production
- Token Expiry - Access tokens expire to limit exposure
- Refresh Rotation - Consider rotating refresh tokens on use
- Secure Storage - Use httpOnly cookies for refresh tokens in production
- Rate Limiting - Implement rate limiting on auth endpoints
- Password Hashing - Passwords are hashed with bcrypt