Solved the issue by myself.
allowNativeBroker: false //Change it to 'false'
In this case, I am not integrating the local Azure AD credential cache into my application.
Since my enterprise Windows computer has an authentication broker pre-installed with the operating system – the Web Account Manager (WAM), it would cause conflicts if I didn't implement MSAL in a way that interacts with the local Azure AD credential data.
If I want to enable seamless login in my custom application with Microsoft MSAL integration, and to run the app inside the enterprise Windows computer, I can code it in the following way:
IPublicClientApplication app =
PublicClientApplicationBuilder.Create("CLIENT_ID_YOU_HAVE")
.WithDefaultRedirectUri()
.Build();
var authResult = await app.AcquireTokenInteractive(new List<string>() { "User.Read" })
.ExecuteAsync();
Reference link:
https://devblogs.microsoft.com/identity/msal-net-wam/#:~:text=Both%20for%20developers%20and%20customers,app%20to%20account%20and%20back.
I'm sharing this answer for others who might encounter a similar issue. I narrowed down the problem's scope by examining the MSAL GitHub library issue threads, where people were facing similar issues and provided a few suggestions for fixes.