acquire_token_interactive() never returns when user does not have access [Bug] #623
-
Describe the bug To Reproduce
Note: The client ID is an internal proof-of-concept Azure AD application. Expected behaviour What you see instead
Ctrl+C terminates the process with a stack trace pointing to time.sleep(1). The MSAL Python version you are using Additional context I believe the Azure AD side of things is configured correctly with respect to redirect URLs - when I am granted permissions, the browser shows success and the Some errors shown in the browser do result in Our workaround is to set the Please accept my apologies if this isn't an issue with the MSAL Python library, or if we've misconfigured our Azure AD application. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
This is by design @craigwalton - most config errors are displayed to the user instead of being relayed back to the app. There is nothing your application can do at runtime with the error information there, except to display some generic "Can't login" which is not ideal. Also, when you say "there is no exit or continue" button, please note that the end-user can close the browser. WIth the system browser, MSAL can't know when the browser is closed. With WAM, the end-user experience is better, because you'll get an "auth cancelled" error whenever the user closes the interactive experience, so you are at least able to monitor cancellations. |
Beta Was this translation helpful? Give feedback.
-
Thank you very much for clarifying this so promptly @bgavrilMS . This all makes sense. Yes, I appreciate that using WAM results in a better UX and the cancellation error. Unfortunately, we haven't been able to come up with a reliable way of obtaining a suitable Windows HWND to pass to MSAL given our library is expected to be run in numerous different environments and we're hesitant about requiring our library users to provide a HWND. Thanks again! |
Beta Was this translation helpful? Give feedback.
-
Thanks for sharing your thoughts with us, @craigwalton . MSAL Python is more or less in the same boat here. If you come up with a decision/solution for the HWND, feel free to let us know. |
Beta Was this translation helpful? Give feedback.
-
Just in case this is of interest to you or other readers: In the meantime, we've opted to:
*We prevent the broker from becoming interactive by either by:
This is a similar approach to what we've taken in another library which uses MSAL for .NET. We've again sidestepped the need to provide a HWND. The main difference being that the .NET MSAL library has explicit support for acquiring a token silently from the broker via Thanks again for your suggestions and support. |
Beta Was this translation helpful? Give feedback.
-
The new conversation goes well beyond the scope of the original issue, so I put it into a separate conversation there. Locking this issue now. |
Beta Was this translation helpful? Give feedback.
This is by design @craigwalton - most config errors are displayed to the user instead of being relayed back to the app. There is nothing your application can do at runtime with the error information there, except to display some generic "Can't login" which is not ideal.
Also, when you say "there is no exit or continue" button, please note that the end-user can close the browser. WIth the system browser, MSAL can't know when the browser is closed.
With WAM, the end-user experience is better, because you'll get an "auth cancelled" error whenever the user closes the interactive experience, so you are at least able to monitor cancellations.