microsoft-authentication-library-for-dotnet: [Bug] MSAL on UWP not working with Http Proxy (WAB does not take OS proxy)

  • Microsoft.Identity.Client v4.5.1 (MSAL)
  • UWP (Windows 10 & Windows IoT Core)

When routing traffic through a proxy server desktop/mobile interactive authentication is having the issue of our app that is currently in production.

Repro

  1. Install & Run a proxy server (CCProxy 8.0)
  2. Configure Windows to use CCProxy as the main proxy for the OS.
  3. Run application and attempt to login with the MSAL library.
_azureAdClientApplication = 
    PublicClientApplicationBuilder.Create(appConfig.AuthScheme.ApiKey)
    .WithAuthority(appConfig.AuthScheme.Authority)
    .Build();

var interactiveBuilder = _azureAdClientApplication.AcquireTokenInteractive(new[] { appConfig.AuthScheme.Scope });
var result = await interactiveBuilder.ExecuteAsync(default(CancellationToken));

Expected behavior When the call to ExecuteAsync is made, the user would see the first page in the Azure AD login workflow. This works when there is no proxy server.

Actual behavior With a proxy configured, the auth dialog display this message: “We can’t connect to the service you need right now. Check your network connection or try this again later.” The only option I have is to close it.

The exception I get has the following message: Web Authentication Broker (WAB) authentication failed. To collect WAB logs, please follow https://aka.ms/msal-net-wab-logs

Its inner exception is a FileNotFoundException.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

Thanks for the recommendations.

  1. I’m not sure how this would work considering the IMsalHttpClientFactory is expecting the System.Net.Http.HttpClient type and won’t build if I use the one you suggested.

  2. I saw this same note for the WPF version of MSAL. If you could reach out, that would be appreciated.