We have a Xamarin.Forms application that I am trying to upgrade to MSAL (has been using ADAL up until now) in order to authenticate users that exist in our Azure Active Directory. The app uses the Prism framework. It seems I am able to use MSAL and authenticate using the app on Android, but when trying to log in on the UWP version, I get an error stating that msedge cannot be opened: msedge.exe error "Windows cannot access the specified device, path or file."
This occurs when AcquireTokenInteractive is called on the PublicClientApp.
public Task<IAuthMSAL> AcquireTokenInteractiveAsync(string[] scopes)
{
var options = new SystemWebViewOptions() { OpenBrowserAsync = SystemWebViewOptions.OpenWithChromeEdgeBrowserAsync };
return PublicClientApp.AcquireTokenInteractive(scopes)
.WithParentActivityOrWindow(ParentWindow)
.WithUseEmbeddedWebView(false)
.WithSystemWebViewOptions(options)
.ExecuteAsync()
.ConvertToProvider();
}
For reference, the PCA is being built just as I've seen it be built in a lot of documentation that I've read:
AuthenticationService.PublicClientApp = PublicClientApplicationBuilder
.Create(config.ClientId)
.WithAuthority(config.Authority)
.WithDefaultRedirectUri()
.WithBroker()
.Build();
Since the error message alludes toward a permission issue or missing executable file, I've ensured that msedge.exe is available in the location shown in the title of the error, and edited the security on the msedege.exe allowing full control on all principals listed (right clicking the executable, selecting properties, security tab) to see if that would help, but it did not.
I've also tried various extension methods on the PublicClientApplicationBuilder class, such as modifying the redirect uri, trying different NuGet packages that go along with Microsoft.Identity.Client (such as .Desktop and .Broker), and also the various methods on IPublicClientApplication, such as WithSystemWebViewOptions, WithUseEmbeddedWebView, etc.
Has anyone else experienced issues when trying to use MSAL with Prism, on UWP specifically? I'm wondering if it is an issue between the two libraries. I have a sample UWP project that does not use Prism, and there are no issues there.
Thanks in advance to anyone that is able to provide some insight on this issue.