Merge "Azure: log authentication errors"

This commit is contained in:
Zuul
2025-12-03 15:59:51 +00:00
committed by Gerrit Code Review

View File

@@ -40,8 +40,15 @@ class AzureAuth(requests.auth.AuthBase):
}
r = requests.post(url, data)
ret = r.json()
self.token = ret['access_token']
self.expiration = float(ret['expires_on'])
if 'access_token' in ret:
self.token = ret['access_token']
self.expiration = float(ret['expires_on'])
elif ('error_codes' in ret and 'error_description' in ret):
raise AzureError(r.status_code,
ret['error_codes'][0],
ret['error_description'])
else:
raise Exception("Unknown error when authenticating to Azure")
def __call__(self, r):
self.refresh()