c3bb93c197
- Add ApiToken model with SHA-256 hashed storage and usage tracking - Create API token CRUD endpoints (POST/GET/DELETE /api/api-tokens/) - Add Bearer token authentication to require_login decorator - Exempt Bearer-authenticated requests from CSRF validation - Add API tokens management page with create/revoke/copy UI - Enhance webhook integration type with detailed explanation and code snippets - Add navigation links (desktop + mobile) to API tokens page - Include 19 tests covering CRUD, auth resolution, and utility functions - Create migration 024_add_api_tokens Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
25 lines
624 B
Python
25 lines
624 B
Python
"""View route for the API Tokens management page.
|
|
|
|
Renders the ``api_tokens.html`` template where users can create, view,
|
|
and revoke their personal API tokens for programmatic access.
|
|
"""
|
|
|
|
import logging
|
|
|
|
from fastapi import APIRouter, Request
|
|
|
|
from app.views.base import require_login, templates
|
|
|
|
logger = logging.getLogger(__name__)
|
|
router = APIRouter()
|
|
|
|
|
|
@router.get("/api-tokens")
|
|
@require_login
|
|
async def api_tokens_page(request: Request):
|
|
"""Render the API Tokens management page."""
|
|
return templates.TemplateResponse(
|
|
"api_tokens.html",
|
|
{"request": request, "page_title": "API Tokens"},
|
|
)
|