question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] Exception when calling MSAL app as “different user”

See original GitHub issue

When 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:closed
  • Created 9 months ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
bgavrilMScommented, Dec 22, 2022

@gladjohn - we should get this behavior documented if it’s unsupported.

1reaction
gladjohncommented, Dec 20, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure MSAL login issue - xamarin.forms
From error message , seems you pass different user identifier to acquire token , please check that firstly . – Nan Yu. Jul...
Read more >
[Bug] LongOBO. Issues with cache serialization after user ...
The app is in production, I haven't upgraded MSAL, but started seeing this ... LongRunning OBO cache fix for different user assertions #3956....
Read more >
Improve CA Error Handling · Issue #1148
This status code means that the application should call the ... apps may want to show different user experience for different levels of ......
Read more >
PublicClientApplication (msal 0.1.3 API) - javadoc.io
MSAL requires the calling app to pass an Activity which MUST call this method to ... If user tries to sign in with...
Read more >
App Authentication client library for .NET - version 1.6.0
Common issues when deployed locally with IIS. Can't retrieve tokens when debugging app in IIS. By default, AppAuth runs in a different user...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found