diff --git a/src/fastapi_oauth2/middleware.py b/src/fastapi_oauth2/middleware.py index 6148338..8481947 100644 --- a/src/fastapi_oauth2/middleware.py +++ b/src/fastapi_oauth2/middleware.py @@ -109,7 +109,7 @@ async def authenticate(self, request: Request) -> Optional[Tuple[Auth, User]]: return Auth(), User() token_data = Auth.jwt_decode(param) - if token_data["exp"] and token_data["exp"] < int(datetime.now(UTC).timestamp()): + if token_data["exp"] and token_data["exp"] < int(datetime.now(timezone.utc).timestamp()): raise OAuth2AuthenticationError(401, "Token expired") user = User(token_data)