Phase 2 part 2: Split auth and user endpoints - Authentication: register, login, refresh_token, logout - Users: get_profile, update_profile, update_theme, change_password - Each endpoint in separate markdown file - Include request/response examples and error codes
898 B
898 B
Login User
Authenticate with email and password.
Endpoint: POST /api/auth/login
Auth: Not required
Content-Type: application/json
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| string | Yes | User's email address | |
| password | string | Yes | User's password |
Example Request
{
"email": "user@example.com",
"password": "SecureP@ss123!"
}
Response (200 OK)
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refresh_token": "d4f5g6h7...",
"user": {
"id": "uuid-here",
"email": "user@example.com",
"username": "john",
"role": "user"
}
}
Error Responses
| Code | Description |
|---|---|
| 401 | Invalid email or password |
| 400 | Missing required fields |