Skip to content

Commit

Permalink
Also handle missing ~/.sumo folder and revoked token (#156)
Browse files Browse the repository at this point in the history
* Also handle missing ~/.sumo folder and revoked token

* flake/black fix
  • Loading branch information
roywilly committed Oct 5, 2023
1 parent 3d7a07b commit df9c7ee
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/sumo/wrapper/_auth_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@ def __init__(self, resource_id):

def get_token(self):
accounts = self._app.get_accounts()
if len(accounts) == 0:
return None
result = self._app.acquire_token_silent([self._scope], accounts[0])
if "error" in result:
raise ValueError(
"Failed to silently acquire token. Err: %s"
% json.dumps(result, indent=4)
)
if result is None:
return None
# ELSE
return result["access_token"]

Expand Down

0 comments on commit df9c7ee

Please sign in to comment.