diff --git a/auth/authenticate.py b/auth/authenticate.py index 0574c08f..18bf11c3 100644 --- a/auth/authenticate.py +++ b/auth/authenticate.py @@ -28,6 +28,9 @@ class JWTAuthenticate(AuthenticationBackend): return AuthCredentials(scopes={}, error_message=str("no token")), AuthUser( user_id=None, username="" ) + + if token.startswith("Bearer"): + token = token[len("Bearer "):] if len(token.split(".")) > 1: payload = await SessionToken.verify(token) diff --git a/resolvers/auth.py b/resolvers/auth.py index ebbb6eae..6e2c894b 100644 --- a/resolvers/auth.py +++ b/resolvers/auth.py @@ -33,6 +33,9 @@ async def get_current_user(_, info): auth: AuthCredentials = info.context["request"].auth token = info.context["request"].headers.get(SESSION_TOKEN_HEADER) + if token.startswith("Bearer"): + token = token[len("Bearer "):] + with local_session() as session: user = session.query(User).where(User.id == auth.user_id).one() user.lastSeen = datetime.now(tz=timezone.utc) diff --git a/services/redis.py b/services/redis.py index 9f3f56f2..6589bb7f 100644 --- a/services/redis.py +++ b/services/redis.py @@ -21,6 +21,9 @@ class RedisCache: return await self._client.execute_command(command, *args, **kwargs) except Exception as e: print(f"[redis] error: {e}") + import traceback + + traceback.print_exc() return None async def subscribe(self, *channels):