Skip to content

Commit

Permalink
refactor: ensure token is not None
Browse files Browse the repository at this point in the history
  • Loading branch information
tigattack committed Sep 16, 2024
1 parent e5ff176 commit af5778b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions dvsa_mot_history/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ async def _get_access_token(self) -> str:
"""Obtain an access token using MSAL."""
token = self.msal_app.acquire_token_for_client(scopes=[self.scope])

if token is None:
raise ValueError("Failed to obtain credentials, token is None")

if not token.get("access_token"):
raise ValueError(
"Failed to obtain credentials, access_token missing from response"
Expand Down

0 comments on commit af5778b

Please sign in to comment.