Skip to content

Commit

Permalink
Fix token expiration time validation
Browse files Browse the repository at this point in the history
  • Loading branch information
KrKOo committed May 30, 2024
1 parent 5f97815 commit 5487cb1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions snakemake_executor_plugin_auth_tes/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 5487cb1

Please sign in to comment.