Closed
Description
Describe the bug
Currently when refreshing token fails, MSAL silences the exception and logs and error:
microsoft-authentication-library-for-python/msal/application.py
Lines 1206 to 1207 in 62752ad
ERROR msal.application:application.py:1152 Refresh token failed
Traceback (most recent call last):
File "C:\Users\user1\Desktop\project\env\lib\site-packages\urllib3\connectionpool.py", line 699, in urlopen
httplib_response = self._make_request(
...
File "C:\Program Files\Python38\lib\ssl.py", line 1173, in send
return self._sslobj.write(data)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\user1\Desktop\project\env\lib\site-packages\requests\adapters.py", line 439, in send
resp = conn.urlopen(
...
File "C:\Users\user1\Desktop\project\env\lib\site-packages\requests\adapters.py", line 498, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))
Currently Azure CLI doesn't print MSAL's logs, the real cause will be hidden and all Azure CLI can get is a None
result. Making it impossible for the end user to know what happened:
if not result:
raise AuthenticationError("Can't find token from MSAL cache.",
recommendation="To re-authenticate, please run:\naz login")
This topic is very similar to the one we discussed in AzureAD/microsoft-authentication-extensions-for-python#92.
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Done