From 163a7c49cd6384c6bb9a4d12b7b5d3f450ffcf79 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 30 Aug 2023 17:51:57 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(utils.py):=20fix=20TypeError?= =?UTF-8?q?=20when=20comparing=20offset-naive=20and=20offset-aware=20datet?= =?UTF-8?q?imes=20in=20get=5Fcurrent=5Fuser=20function?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/services/auth/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/backend/langflow/services/auth/utils.py b/src/backend/langflow/services/auth/utils.py index a434fefcb..1431ee615 100644 --- a/src/backend/langflow/services/auth/utils.py +++ b/src/backend/langflow/services/auth/utils.py @@ -89,7 +89,8 @@ async def get_current_user( user_id: UUID = payload.get("sub") # type: ignore token_type: str = payload.get("type") # type: ignore if expires := payload.get("exp", None): - expires_datetime = datetime.fromtimestamp(expires) + expires_datetime = datetime.fromtimestamp(expires, timezone.utc) + # TypeError: can't compare offset-naive and offset-aware datetimes if datetime.now(timezone.utc) > expires_datetime: raise credentials_exception