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] WebView2-based embedded browser does not work in protected directories

See original GitHub issue

Which Version of MSAL are you using ? MSAL 4.28.2

Platform net5-windows10.0.17763.0

What authentication flow has the issue?

  • Desktop / Mobile
    • Interactive

Is this a new or existing app? This is an existing app attempting to adopt new feature.

Repro

  1. Install the “evergreen” WebView2 runtime
  2. Create a .NET 5 console app with the following code
var pca = PublicClientApplicationBuilder.Create(clientId).Build();
var result = await pca.AcquireTokenInteractive(scopes)
   .WithUseEmbeddedWebView(true)
   .ExecuteAsync();
  1. dotnet publish -r win-x86 the application and copy the publish output in to a directory like %ProgramFiles% (one that requires admin permission to create a new folder).
  2. Run the console app from the new location.

Expected behavior An embedded WebView2-based browser window appears asking for sign-in.

Actual behavior An empty WinForms dialog appears. There are no errors.

Possible Solution Set the WebView2 runtime environment to point the user data folder outside of the protected directory. https://docs.microsoft.com/en-gb/microsoft-edge/webview2/concepts/userdatafolder

Additional context/ Logs / Screenshots The folder the WebView2 runtime tries to create a user data directory, for the browser profile information (cookies, etc). Moving the executable outside of a protected directory (where non-admin users have write and modify permissions) allows the WebView2 runtime to work.

image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:15 (11 by maintainers)

github_iconTop GitHub Comments

4reactions
bgavrilMScommented, Apr 20, 2021

Also, we’ve discussed with the WebView2 SDK folks and they are actively working on a solution “out of the box”. So in MSAL 4.30 we will be setting the UserFolder out of program files and when WebView2 SDK finish up their work (no ETA, but work is in progress), we would upgrade as well.

1reaction
pmaytakcommented, Apr 22, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues with embedded Anyconnect Web bBrowser and ...
Solved: We have AnyConnect 4.10.05111 installed and use Okta to connect with SAML AnyConnect is set to use the embedded browser but it ......
Read more >
Smart View for Office Installation and Configuration Guide, ...
If you encounter issues related to installation and startup, see Tips and. Troubleshooting. Installing Browser Add-ons. You can use Oracle Smart View for...
Read more >
Can't access another file from password-protected directory ...
In your current setup this is expected behavior. You ARE requesting a file from a protected folder. htaccess guards HTTP browser requests.
Read more >
Ivanti Pulse Client for Desktop Release Notes 9.1R15.2
Pulse Client uses Microsoft Edge WebView2 based Embedded browser, on all Windows platforms, ... Upgrade to PDC 9.1R7 results in folder access issues....
Read more >
pdfMachine faq
As Internet Explorer is at its end of life pdfMachine now embeds a Microsoft Edge WebView2 based window in the Viewer. The PDF...
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