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
50 lines
898 B
Markdown
50 lines
898 B
Markdown
# 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 |
|
|
|--------|------|-----------|-------------|
|
|
| email | string | Yes | User's email address |
|
|
| password | string | Yes | User's password |
|
|
|
|
### Example Request
|
|
|
|
```json
|
|
{
|
|
"email": "user@example.com",
|
|
"password": "SecureP@ss123!"
|
|
}
|
|
```
|
|
|
|
## Response (200 OK)
|
|
|
|
```json
|
|
{
|
|
"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 |
|
|
|
|
## Try It Out
|
|
|
|
<!-- API Explorer will be inserted here in Phase 3 -->
|