debug: add logging to auth cookie handling
Add debug logging to understand why /auth/me succeeds but /users/me/config fails with 401.
This commit is contained in:
@@ -151,7 +151,9 @@ async def me(
|
|||||||
session_cookie: str | None = Cookie(default=None, alias="session"),
|
session_cookie: str | None = Cookie(default=None, alias="session"),
|
||||||
session: AsyncSession = Depends(get_db_session),
|
session: AsyncSession = Depends(get_db_session),
|
||||||
) -> dict[str, Any]:
|
) -> dict[str, Any]:
|
||||||
|
logger.info("/auth/me called, session_cookie present: %s", bool(session_cookie))
|
||||||
if not session_cookie:
|
if not session_cookie:
|
||||||
|
logger.warning("/auth/me: no session cookie")
|
||||||
raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail="missing session")
|
raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail="missing session")
|
||||||
|
|
||||||
settings = Settings()
|
settings = Settings()
|
||||||
|
|||||||
@@ -18,8 +18,14 @@ async def get_db_session():
|
|||||||
async def get_current_user_id(
|
async def get_current_user_id(
|
||||||
session_cookie: Annotated[str | None, Cookie()] = None,
|
session_cookie: Annotated[str | None, Cookie()] = None,
|
||||||
) -> uuid.UUID:
|
) -> uuid.UUID:
|
||||||
|
import logging
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
if not session_cookie:
|
if not session_cookie:
|
||||||
|
logger.warning("No session cookie found in request")
|
||||||
raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail="missing session")
|
raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail="missing session")
|
||||||
|
|
||||||
|
logger.debug("Session cookie found: %s...", session_cookie[:20])
|
||||||
|
|
||||||
settings = Settings()
|
settings = Settings()
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user