From 5487cb14126d02d0174bb8718989245a80eef25e Mon Sep 17 00:00:00 2001 From: KrKOo Date: Thu, 30 May 2024 13:53:53 +0200 Subject: [PATCH] Fix token expiration time validation --- snakemake_executor_plugin_auth_tes/auth.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/snakemake_executor_plugin_auth_tes/auth.py b/snakemake_executor_plugin_auth_tes/auth.py index 3c058b8..2ca0db4 100644 --- a/snakemake_executor_plugin_auth_tes/auth.py +++ b/snakemake_executor_plugin_auth_tes/auth.py @@ -30,7 +30,7 @@ def is_token_expired(self, token, time_offset=0): data = jwt.decode( token, key, [header["alg"]], options={"verify_aud": False} ) - if data["exp"] - time_offset: + if data["exp"] - time_offset < 0: return True except jwt.ExpiredSignatureError: return True @@ -88,7 +88,10 @@ def exchange_access_token(self, token, scopes, audience=None): return response.json() def refresh_access_token(self, refresh_token): - body = {"refresh_token": refresh_token, "grant_type": "refresh_token" ""} + body = { + "refresh_token": refresh_token, + "grant_type": "refresh_token", + } response = requests.post(self.token_url, body, auth=self.basic_auth)