Microsoft Authentication Library (MSAL) for Python makes it easy to authenticate to Microsoft Entra ID. General docs are available here https://learn.microsoft.com/entra/msal/python/ Stable APIs are documented here https://msal-python.readthedocs.io. Questions can be asked on www.stackoverflow.com with tag "msal" + "python".
Describe the bug
When using the acquire_token_interactive method with a timeout that is hit, the exception that is raised does not indicate a timeout occurred. Instead an AssertionError is raised.
Expected behavior
Some type of exception or message that is surfaced to the user, indicating a timeout has occurred.
What you see instead
File "/home/pvaneck/dev/pvaneck/azure-sdk-for-python/sdk/identity/azure-identity/test2.py", line 61, in <module>
result = app.acquire_token_interactive([scope], timeout=5)
File "/home/pvaneck/dev/pvaneck/azure-sdk-for-python/sdk/identity/azure-identity/.venv/lib/python3.10/site-packages/msal/application.py", line 1828, in acquire_token_interactive
response = _clean_up(self.client.obtain_token_by_browser(
File "/home/pvaneck/dev/pvaneck/azure-sdk-for-python/sdk/identity/azure-identity/.venv/lib/python3.10/site-packages/msal/oauth2cli/oidc.py", line 281, in obtain_token_by_browser
return super(Client, self).obtain_token_by_browser(
File "/home/pvaneck/dev/pvaneck/azure-sdk-for-python/sdk/identity/azure-identity/.venv/lib/python3.10/site-packages/msal/oauth2cli/oauth2.py", line 639, in obtain_token_by_browser
return self._obtain_token_by_browser(
File "/home/pvaneck/dev/pvaneck/azure-sdk-for-python/sdk/identity/azure-identity/.venv/lib/python3.10/site-packages/msal/oauth2cli/oauth2.py", line 677, in _obtain_token_by_browser
return self.obtain_token_by_auth_code_flow(
File "/home/pvaneck/dev/pvaneck/azure-sdk-for-python/sdk/identity/azure-identity/.venv/lib/python3.10/site-packages/msal/application.py", line 134, in obtain_token_by_auth_code_flow
assert isinstance(auth_code_flow, dict) and isinstance(auth_response, dict)
AssertionError
We do not recommend setting a timeout on AcquireTokenInteractive. Users can spend quitea long time in the browser, for example they may be asked to MFA and to change their password.
Describe the bug When using the
acquire_token_interactive
method with a timeout that is hit, the exception that is raised does not indicate a timeout occurred. Instead an AssertionError is raised.To Reproduce Code to reproduce:
Expected behavior Some type of exception or message that is surfaced to the user, indicating a timeout has occurred.
What you see instead
The MSAL Python version you are using
1.20.0