-
Notifications
You must be signed in to change notification settings - Fork 337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] WebView2-based embedded browser does not work in protected directories #2502
Comments
I got exactly the same issue but using a WPF .NET Core 3.1 application and the Visual Studio Setup project to create an installer (setup.exe)
Then, when calling the AcquireTokenInteractive
I dont get any error, but if I run the app as administrador I receive the following error Microsoft Edge can't read and write to its data directory. I was reviewing the code to see if you guys were implementing the |
Thanks for feedback, will take a look soon. |
Let's try to not expose another property for now, but if we need to, we have options here: Line 21 in 504fb35
|
IMO a good solution would be to either a) try and use the same directory as the installed Edge browser (if available), or b) pick a location in This would mean all MSAL WebView2 instances (evergreen or fixed) share the same data directory. This is the same as with "WebView1" which shares the user's main Internet Explorer settings IIRC. |
@mjcheetham Just got this scenario working. will be in next release. 4.30.0 |
@trwalke Sorry for being late to the conversation, but I feel that it's important for packaged apps to store their app data within the My preference to fix it would be one of the following:
|
@FreddyD-GH as we are trying to avoid adding additional api for this at the moment but I will try using @bgavrilMS do you think we can create a separate feature request for this api? |
We can definitely improve our existing sample around CustomWebUi, as the current one is a bit pointless: |
I used to be, historically when there was no other choice for .NET Core? |
Ideally WebView2 SDK would give a good default, and @trwalke is starting a conversation with the team behind it on this. We want to do the right thing out of the box, so as @FreddyD-GH suggested, we need to detect if the app is msix or not. We can use the logic here to do that - https://github.com/qmatteoq/DesktopBridgeHelpers/blob/master/DesktopBridge.Helpers/Helpers.cs |
Hi Team, Thanks |
@sakkumarfirstam : we'd want to release it this week. |
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. |
This is included in MSAL 4.30.0 release. cc: @mjcheetham @sakkumarfirstam @luismiguelsanchezGL @FreddyD-GH |
@mjcheetham @sakkumarfirstam @luismiguelsanchezGL |
Which Version of MSAL are you using ?
MSAL 4.28.2
Platform
net5-windows10.0.17763.0
What authentication flow has the issue?
Is this a new or existing app?
This is an existing app attempting to adopt new feature.
Repro
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).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.
The text was updated successfully, but these errors were encountered: