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".
Symptom
While developing a PoC to solve #335, I noticed that
skip_account_creation
added by #262 never seems to make its way intoTokenCache.__add
.skip_account_creation
is assigned here and the lambda is passed toobtain_token_by_refresh_token
viaon_obtaining_tokens
:https://github.com/AzureAD/microsoft-authentication-library-for-python/blob/0f1ab8d5d97b3722776c2c661f6f083a26d1fec2/msal/application.py#L948-L957
However,
on_obtaining_tokens
is discarded byobtain_token_by_refresh_token
:https://github.com/AzureAD/microsoft-authentication-library-for-python/blob/eb0a86fb6bf1b021ef58a872213ec88af86212d7/msal/oauth2cli/oauth2.py#L769-L813
To Reproduce
before https://github.com/AzureAD/microsoft-authentication-library-for-python/blob/31b24afe3eb6edd3af58bab40f1387be02cb389d/msal/token_cache.py#L178
None
meansskip_account_creation
is not set.Change
After the change, the output is