Skip to content

Commit

Permalink
Fix bug causing old token to be used with requests after refreshing
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel committed Jun 24, 2024
1 parent 21bcc64 commit 88faa70
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions neon_utils/hana_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ def _refresh_token(backend_address: str):
raise ServerException(f"Error updating token from {backend_address}. "
f"{update.status_code}: {update.text}")
_client_config = update.json()

# Update request headers with new token
global _headers
_headers['Authorization'] = f"Bearer {_client_config['access_token']}"

client_config_path = _get_client_config_path(backend_address)
with open(client_config_path, "w+") as f:
json.dump(_client_config, f, indent=2)
Expand Down

0 comments on commit 88faa70

Please sign in to comment.