[Bug] Exception when calling MSAL app as “different user”
See original GitHub issueWhen running MSAL app as a different user one can get en exception which is not very readable. To call this exception the next code has to be run:
var accounts = await app.GetAccountsAsync(); IAccount firstAccount = accounts.FirstOrDefault(); authResult = await app.AcquireTokenInteractive(scopes) .WithAccount(firstAccount) .WithParentActivityOrWindow(new WindowInteropHelper(this).Handle) // optional, used to center the browser on the window .WithPrompt(Prompt.SelectAccount) .ExecuteAsync();
After calling this code the next exception is thrown:
Error Acquiring Token: MSAL.Desktop.4.48.1.0.MsalServiceException: ErrorCode: unknown_broker_error Microsoft.Identity.Client.MsalServiceException: Unknown Status: Unexpected Error: 0xffffffff80070520 Context: Winrt exception was thrown ‘(pii)’. Tag: 0x2339e4e3 (error code -2147023584) (internal error code 590996707) at Microsoft.Identity.Client.Broker.WamAdapters.ThrowExceptionFromWamError(AuthResult authResult, AuthenticationRequestParameters authenticationRequestParameters, ILoggerAdapter logger) at Microsoft.Identity.Client.Broker.WamAdapters.HandleResponse(AuthResult authResult, AuthenticationRequestParameters authenticationRequestParameters, ILoggerAdapter logger, String errorMessage) at Microsoft.Identity.Client.Broker.RuntimeBroker.d__11.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at Microsoft.Identity.Client.Broker.RuntimeBroker.d__10.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Identity.Client.Internal.Broker.BrokerInteractiveRequestComponent.d__9.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Identity.Client.Internal.Requests.InteractiveRequest.d__10.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Identity.Client.Internal.Requests.InteractiveRequest.d__11.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Identity.Client.Internal.Requests.InteractiveRequest.d__9.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Identity.Client.Internal.Requests.RequestBase.d__12.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Identity.Client.ApiConfig.Executors.PublicClientExecutor.d__2.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at active_directory_wpf_msgraph_v2.MainWindow.d__7.MoveNext() in D:\TreatConcierge\azureAdAuth\PoCTreatConcierge\active-directory-dotnet-desktop-msgraph-v2-msal3x\PoCTreatConcierge\MainWindow.xaml.cs:line 137 StatusCode: 0 ResponseBody: Headers:
The exception should be more readable and user-friendly.
Issue Analytics
- State:
- Created 9 months ago
- Comments:5 (4 by maintainers)
Top GitHub Comments
@gladjohn - we should get this behavior documented if it’s unsupported.
Thanks for the feedback @bodnarpolina, we are working on exposing PII Logs and error messages in the new preview broker. Will update once we have the feature ready.