Files
headquarter/docs/api/auth.md
Fusion 83f94b1f09 docs: comprehensive documentation overhaul
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
2026-05-19 14:18:20 +02:00

1.6 KiB

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)

{
  "detail": "Invalid state parameter"
}

GET /auth/me

Description: Get current authenticated user.

Auth: Required (session cookie)

Response

Success (200 OK)

{
  "id": "uuid",
  "email": "user@example.com",
  "name": "User Name",
  "avatar_url": "https://..."
}

Error (401 Unauthorized)

{
  "detail": "Not authenticated"
}

POST /auth/logout

Description: Log out current user.

Auth: Required (session cookie)

Response

Success (200 OK)

Clears session cookie.

{
  "message": "Logged out"
}