Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vdk-control-api-auth: add better error message for refresh token failure #2607

Merged
merged 1 commit into from
Aug 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,16 @@ def __exchange_refresh_for_access_token(self):
response = post(
self._cache.authorization_url, data=data, headers=headers, auth=basic_auth
)
if response.status_code >= 400:
raise VDKAuthException(
what="Failed to refresh access token",
why="Authorization server returned status code: {response.status_code}, error response: {response.text}",
consequence="Subsequent API calls may fail.",
countermeasure="Try to log in again the usual way. "
"If using the CLI, you can login using the 'vdk login' command. "
"If using a notebook, use the Login Button.",
)

json_data = json.loads(response.text)
log.debug(
f"Refresh access token response received: status: {response.status_code}"
Expand Down