diff --git a/dvsa_mot_history/client.py b/dvsa_mot_history/client.py index a0cf72e..f5aaac6 100644 --- a/dvsa_mot_history/client.py +++ b/dvsa_mot_history/client.py @@ -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"