WebView2Feedback icon indicating copy to clipboard operation
WebView2Feedback copied to clipboard

[Problem/Bug]: IsPasswordAutofillEnabled not working anymore

Open Kay-Burchardt opened this issue 1 year ago • 7 comments

What happened?

We noticed that password autofill in Webview2 is not working anymore. Originally we activated it in the Webview2 settings. Some time ago, I changed our implementation to use profiles. Back then, password autofill still worked. After we realized that it's not working anymore, I tried to enable it through the profile property instead of the webview2 setting. But that didn't help. I observed the protocols of our former automated tests, and it seems that it still worked with Webview2 runtime v 121 but stopped with 122. Unfortunately we are using the evergreen installer and the fixed version 121 is not available for download anymore, so I cannot validate it.

Importance

Moderate. My app's user experience is affected, but still usable.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

123.0.2420.65

SDK Version

120.0.2210.55

Framework

Win32

Operating System

Windows 11

OS Version

No response

Repro steps

Enable property IsPasswordAutofillEnabled of either IWebview2Settings or IWebview2Profile. Fill password field of arbitrary form and submit. In the past, Webview2 asked to store password. But not anymore.

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

Regression in newer Runtime

Last working version (if regression)

Runtime 121?

AB#50049182

Kay-Burchardt avatar Apr 05 '24 13:04 Kay-Burchardt

I see different names of the API - IsGeneralAutofillEnabled and IsPasswordAutosaveEnabled - which ones are you using? Are all of them broken for you?

vbryh-msft avatar Apr 05 '24 18:04 vbryh-msft

We are using both. IsGeneralAutofillEnabled is still working as expected. Only IsPasswordAutosaveEnabled is broken.

Kay-Burchardt avatar Apr 08 '24 06:04 Kay-Burchardt

@Kay-Burchardt I was able to reproduce the bug, we will open a bug on our side and will add updates to this thread.

maurawinstanley avatar Apr 08 '24 22:04 maurawinstanley

Did you find a solution to this problem? I am having the same problem. :)

DeanFredrickson avatar Apr 21 '24 19:04 DeanFredrickson

@DeanFredrickson We have located the cause and made a fix. This fix will be available to you after 4.25 if all goes well.

liu-lichen avatar Apr 23 '24 02:04 liu-lichen

It looks like this is working now! 😄🙌🏻

milesbuckton avatar Apr 29 '24 08:04 milesbuckton

It is still now working for me. the version I have is: 1.0.2478.35, is that the correct update? Or is it my code?
private void webViewCoreWebView2InitializationCompleted(object sender, CoreWebView2InitializationCompletedEventArgs e) { CoreWebView2Settings Settings; Settings = dashboardWebview.CoreWebView2.Settings; Settings.IsPasswordAutosaveEnabled = true; Settings.IsGeneralAutofillEnabled = true; }

DeanFredrickson avatar May 02 '24 15:05 DeanFredrickson

@liulichen0603 It is still not working for me. the version I have is: 1.0.2478.35, is that the correct update? Or is it my code? private void webViewCoreWebView2InitializationCompleted(object sender, CoreWebView2InitializationCompletedEventArgs e) { CoreWebView2Settings Settings; Settings = dashboardWebview.CoreWebView2.Settings; Settings.IsPasswordAutosaveEnabled = true; Settings.IsGeneralAutofillEnabled = true; }

DeanFredrickson avatar May 12 '24 19:05 DeanFredrickson

What's the status of this? I'm running into the same problem using the above code and version 1.0.2651.64 - no passwords are being remembered or prompted to be remembered.

DRAirey1 avatar Aug 26 '24 14:08 DRAirey1

@DRAirey1 What is your runtime version that it is not working and what is the last one you have seen working. Thanks

vbryh-msft avatar Aug 26 '24 15:08 vbryh-msft

This is a new deployment, I have no working version of an embedded browser with autocomplete passwords yet.

I'm not sure I understand your question. I'm targeting WinUI. Here are the settings:

<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>    

Here are the packages:

<ItemGroup>
     <PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.240802000" />
     <PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1" />
 </ItemGroup>

DRAirey1 avatar Aug 26 '24 16:08 DRAirey1

@vbryh-msft Just to make sure it wasn't my code that was at fault, I downloaded the samples from [https://github.com/MicrosoftEdge/WebView2Samples]WebView2Samples and ran into the same problem: no prompt, no saved passwords.

DRAirey1 avatar Aug 26 '24 16:08 DRAirey1

This is fixed in runtimes 124.0.2478.63+. Thanks!

@DRAirey1 In the sample app, make sure you select "Settings > Toggle Password Autosave" to enable password saving. In your app, make sure CoreWebView2.Profile.IsPasswordAutosaveEnabled = true. It's false by default. https://learn.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2profile.ispasswordautosaveenabled?view=webview2-dotnet-1.0.2739.15

champnic avatar Sep 05 '24 23:09 champnic

@champnic - Have you actually taken the sample application and forced it to autofill the password field? Try using the URL of "https://portal.azure.com/" and then please let me know what you did to change the sample app, because I can't get it to work with your suggestion.

DRAirey1 avatar Sep 17 '24 20:09 DRAirey1

I tested by navigating to https://fill.dev/form/login-simple using WebView2 runtime version 127.0.2651.105, with the "Settings > Toggle Password Autosave" enabled in the WebView2APISample application.

What is your setup? Are you seeing this fail on other pages besides https://portal.azure.com?

champnic avatar Sep 17 '24 22:09 champnic

using WebView2 runtime version 127.0.2651.105

Let's start with this. What do you mean "runtime version"? Is that a package version, a framework version? What? Nothing I use starts with a version of 127. It looks more like a NuGet package version. Show me exactly how you set this in your .csproj files, please.

"Settings > Toggle Password Autosave"

Where do you see a 'settings' option in the IDE? If this is supposed to be code, then please show the code.

DRAirey1 avatar Sep 17 '24 22:09 DRAirey1

Hey @DRAirey1 -

The WebView2 runtime is a platform component that is shipped with Windows (or distributed separately). You can learn more here: https://learn.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution?tabs=dotnetcsharp When you launch the WebView2 sample app it will tell you what version of the runtime it's using. You can also open Windows Settings > Apps > Installed Apps and search for 'WebView2' to see what version is installed on your machine: image

The :"Toggle Password Autosave" setting can be found in our WebView2APISample application. Here is some information about how to get it: https://learn.microsoft.com/en-us/microsoft-edge/webview2/samples/webview2apissample

champnic avatar Sep 21 '24 04:09 champnic

@champnic This is NOT fixed as of 129.0.2792.79. Please reopen the case:

image

        private async void WebView2_CoreWebView2Initialized(WebView2 sender, CoreWebView2InitializedEventArgs args)
        {
            await sender.EnsureCoreWebView2Async();
            sender.CoreWebView2.Settings.IsPasswordAutosaveEnabled = true;

            if (args.Exception != null)
            {
                StatusUpdate($"Error initializing WebView2: {args.Exception.Message}");
            }
            else
            {
                SetTitle(sender);
            }
        }

DRAirey1 avatar Oct 09 '24 12:10 DRAirey1

@champnic Ah, now I understand your comments. The WPF does indeed have a 'Settings -> Toggle Password Autosave'. The WinUI example doesn't. The Password Autosave appears to work in the WPF example, but not in the WinUI example, so I'm guessing that there's some configuration issue possibly with cookies, profiles or browser history settings. What settings/configuration do I need in the WinUI example that will allow it to save passwords like the WPF example?

DRAirey1 avatar Oct 09 '24 14:10 DRAirey1

@DRAirey1 Aha good catch!

After you set the setting to true, are you navigating to a new page? Settings typically only take effect after a new navigation or reload.

champnic avatar Oct 09 '24 18:10 champnic

Setting it exactly as it appears in the code snippet above: during initialization. I've spent a great deal of time on this issue. If you could show me what lines to change in the example WinUI program to make this feature work, I'd be very grateful. Also, this is a function that auto fills the password for a sign-in page. It's going to be the first page in any useful application, so I'm not sure how useful this feature would be if it could only be used on a 'new' page or reload.

DRAirey1 avatar Oct 09 '24 18:10 DRAirey1

Facing the same issue on my end. Using wails(golang framework for gui apps) and it uses webvew2 as a backend. GeneralAutofill and PasswordAutosave are both enabled (validated with runtime calls to webview2 api). Save and Autofill works for username/emails inputs. But not for passwords. Webview2 version: 129.0.2792.89

Any updates/ideas on whats happening here?

hyptocrypto2 avatar Oct 15 '24 16:10 hyptocrypto2