debug: add auth mismatch logging

Logs the first 8 chars of expected vs provided API key on 401
to diagnose auth issues from EspoCRM.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-13 18:09:49 +00:00
parent 9b0fb35b40
commit 4dc25d08a3
+5
View File
@@ -27,6 +27,11 @@ def _verify_auth(request: Request):
return # No auth configured
provided = request.headers.get("X-Api-Key", "")
if provided != expected:
logger.warning(
"[auth] Key mismatch — expected=%s... provided=%s...",
expected[:8] if expected else "NONE",
provided[:8] if provided else "NONE",
)
raise HTTPException(status_code=401, detail="Unauthorized")