83f94b1f09
Add complete documentation structure: - Frontend architecture documentation - Database schema documentation - Deployment guides (Docker, Traefik, Authentik, Environment) - Development guides (Setup, Testing, Contributing, Quality Gates) - Deployment architecture documentation - Updated docs README with complete navigation All new features and APIs are now documented. Quality gates: docs only, no code changes
106 lines
1.6 KiB
Markdown
106 lines
1.6 KiB
Markdown
# Auth API
|
|
|
|
Authentication endpoints for OAuth2 login via Authentik.
|
|
|
|
## Authentication
|
|
|
|
These endpoints handle the OAuth2 flow. No prior authentication is required for `/auth/login` and `/auth/callback`.
|
|
|
|
---
|
|
|
|
## GET /auth/login
|
|
|
|
**Description:** Initiate OAuth2 login flow. Redirects to Authentik.
|
|
|
|
### Request
|
|
|
|
#### Query Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
|-----------|------|----------|-------------|
|
|
| `next` | `string` | No | URL to redirect to after login |
|
|
|
|
### Response
|
|
|
|
#### Success (307 Temporary Redirect)
|
|
|
|
Redirects to Authentik OAuth2 authorization URL.
|
|
|
|
---
|
|
|
|
## GET /auth/callback
|
|
|
|
**Description:** Handle OAuth2 callback from Authentik.
|
|
|
|
### Request
|
|
|
|
#### Query Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
|-----------|------|----------|-------------|
|
|
| `code` | `string` | Yes | Authorization code from Authentik |
|
|
| `state` | `string` | Yes | State parameter for CSRF protection |
|
|
|
|
### Response
|
|
|
|
#### Success (307 Temporary Redirect)
|
|
|
|
Sets session cookie and redirects to frontend.
|
|
|
|
#### Error (400 Bad Request)
|
|
|
|
```json
|
|
{
|
|
"detail": "Invalid state parameter"
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
## GET /auth/me
|
|
|
|
**Description:** Get current authenticated user.
|
|
|
|
**Auth:** Required (session cookie)
|
|
|
|
### Response
|
|
|
|
#### Success (200 OK)
|
|
|
|
```json
|
|
{
|
|
"id": "uuid",
|
|
"email": "user@example.com",
|
|
"name": "User Name",
|
|
"avatar_url": "https://..."
|
|
}
|
|
```
|
|
|
|
#### Error (401 Unauthorized)
|
|
|
|
```json
|
|
{
|
|
"detail": "Not authenticated"
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
## POST /auth/logout
|
|
|
|
**Description:** Log out current user.
|
|
|
|
**Auth:** Required (session cookie)
|
|
|
|
### Response
|
|
|
|
#### Success (200 OK)
|
|
|
|
Clears session cookie.
|
|
|
|
```json
|
|
{
|
|
"message": "Logged out"
|
|
}
|
|
```
|