Two gaps found while wiring auth into the data routes: 1. mcp_server/auth.py: HTTPBearer() defaults to auto_error=True, which rejects any request with no Authorization header before get_current_user's own "auth not configured -> allow as guest" check ever runs. That meant turning on Depends(get_current_user) anywhere 401'd every request even with auth fully disabled. Switched to auto_error=False and handle the missing-credentials case explicitly inside get_current_user instead. 2. Frontend never actually sent the stored token on data requests. auth.tsx only attached it to its own /api/auth/me check; api.ts's fetch() calls (chat, stats, documents, upload, delete) and every axios call elsewhere in the app (projects, kanban, hooks) had no Authorization header at all. Added an authHeaders() helper in api.ts, and a single axios request interceptor in auth.tsx that attaches the token app-wide since every component imports the same default axios instance. Known gap not addressed here: mcp_server/claude_code_mcp.py (the code-forge stdio MCP server) calls the REST API with no token at all. Harmless while auth is disabled (current state), but it will start getting 401'd the moment CLAUDE_OS_EMAIL/PASSWORD are actually set - needs a service-token bypass if that's ever turned on. |
||
|---|---|---|
| .. | ||
| tools | ||
| __init__.py | ||
| auth.py | ||
| claude_code_mcp.py | ||
| server.py | ||