Skip to content

Commit

Permalink
Updated TZ conversion before deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
miballe committed Aug 29, 2024
1 parent 8e319da commit 8631d83
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/factiva/analytics/auth/oauthuser.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ def get_id_token(self) -> bool:
self._id_token = response_body['id_token']
self._access_token = response_body['access_token']
bearer_payload = eval(base64.b64decode(self._access_token.split('.')[1] + '==').decode('utf-8'))
self._id_expiration = datetime.datetime.utcfromtimestamp(int(bearer_payload['exp'])).replace(tzinfo=datetime.timezone.utc)
# self._id_expiration = datetime.datetime.utcfromtimestamp(int(bearer_payload['exp'])).replace(tzinfo=datetime.timezone.utc)
self._id_expiration = datetime.datetime.fromtimestamp(int(bearer_payload['exp']), datetime.UTC)
return True
elif authn_response.status_code == 403:
raise PermissionError('Invalid user credentials')
Expand Down Expand Up @@ -232,7 +233,8 @@ def get_jwt_token(self) -> bool:
response_body = authz_response.json()
self._jwt_token = response_body["access_token"]
bearer_payload = eval(base64.b64decode(self._jwt_token.split('.')[1] + '==').decode('utf-8'))
self._jwt_expiration = datetime.datetime.utcfromtimestamp(int(bearer_payload['exp'])).replace(tzinfo=datetime.timezone.utc)
# self._jwt_expiration = datetime.datetime.utcfromtimestamp(int(bearer_payload['exp'])).replace(tzinfo=datetime.timezone.utc)
self._jwt_expiration = datetime.datetime.fromtimestamp(int(bearer_payload['exp']), datetime.UTC)
return True


Expand Down

0 comments on commit 8631d83

Please sign in to comment.