diff --git a/backend/src/backend/primary/routers/general.py b/backend/src/backend/primary/routers/general.py index d22c49ebb..29e9c7f9f 100644 --- a/backend/src/backend/primary/routers/general.py +++ b/backend/src/backend/primary/routers/general.py @@ -2,6 +2,7 @@ import datetime import logging +import httpx import starsessions from starlette.responses import StreamingResponse from fastapi import APIRouter, HTTPException, Request, status, Depends, Query @@ -74,8 +75,10 @@ async def logged_in_user( user_info.avatar_b64str = avatar_b64str if graph_user_info is not None: user_info.display_name = graph_user_info.get("displayName", None) - except Exception as e: - print("Error while fetching user avatar and info from Microsoft Graph API:\n", e) + except httpx.HTTPError as e: + print("Error while fetching user avatar and info from Microsoft Graph API (HTTP error):\n", e) + except httpx.InvalidURL as e: + print("Error while fetching user avatar and info from Microsoft Graph API (Invalid URL):\n", e) return user_info diff --git a/backend/src/services/utils/authenticated_user.py b/backend/src/services/utils/authenticated_user.py index 67df71e9e..3b28aa515 100644 --- a/backend/src/services/utils/authenticated_user.py +++ b/backend/src/services/utils/authenticated_user.py @@ -20,11 +20,11 @@ def __init__( ) -> None: self._user_id = user_id self._username = username - self._graph_access_token = access_tokens.get("graph_access_token", None) - self._sumo_access_token = access_tokens.get("sumo_access_token", None) - self._smda_access_token = access_tokens.get("smda_access_token", None) - self._pdm_access_token = access_tokens.get("pdm_access_token", None) - self._ssdl_access_token = access_tokens.get("ssdl_access_token", None) + self._graph_access_token = access_tokens.get("graph_access_token") + self._sumo_access_token = access_tokens.get("sumo_access_token") + self._smda_access_token = access_tokens.get("smda_access_token") + self._pdm_access_token = access_tokens.get("pdm_access_token") + self._ssdl_access_token = access_tokens.get("ssdl_access_token") def __hash__(self) -> int: return hash(self._user_id)