Skip to content
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

Password autosave + suggest #2291

Closed
amellini opened this issue Mar 21, 2022 · 6 comments
Closed

Password autosave + suggest #2291

amellini opened this issue Mar 21, 2022 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@amellini
Copy link

Hi all,
I'm trying to use webview2 to authenticate against IdentityServer 4 for my WPF app.
I'm using OidcClient (from IdentityModel) with this implementation:

var options = new OidcClientOptions()
{
	Authority = App.ApplicationSettings.IdentityServerUrl,
	ClientId = App.ApplicationSettings.ClientId,
	Scope = App.ApplicationSettings.Scope,
	RedirectUri = App.ApplicationSettings.ClientRedirectUri,
	Browser = new EmbeddedBrowser(),
	LoadProfile = true,
	Policy = new Policy
	{
		RequireIdentityTokenSignature = false
	}
};

Using this as WebView2:

var semaphoreSlim = new SemaphoreSlim(0, 1);
var browserResult = new BrowserResult()
{
	ResultType = BrowserResultType.UserCancel
};

var signinWindow = new Window()
{
	Width = 800,
	Height = 600,
	Title = "Sign In",
	WindowStartupLocation = WindowStartupLocation.CenterScreen
};
signinWindow.Closing += (s, e) =>
{
	semaphoreSlim.Release();
};

var webView = new WebView2();
webView.NavigationStarting += async (s, e) =>
{
	if (IsBrowserNavigatingToRedirectUri(new Uri(e.Uri)))
	{
		e.Cancel = true;
		browserResult = new BrowserResult()
		{
			ResultType = BrowserResultType.Success,
			Response = new Uri(e.Uri).AbsoluteUri
		};

		semaphoreSlim.Release();
		signinWindow.Close();
	}
};

signinWindow.Content = webView;
signinWindow.Show();

webView.CreationProperties = new CoreWebView2CreationProperties(); 
var env = await CoreWebView2Environment.CreateAsync();

await webView.EnsureCoreWebView2Async(env);

webView.CoreWebView2.Settings.IsPasswordAutosaveEnabled = true;
webView.CoreWebView2.Settings.IsGeneralAutofillEnabled = true;

// Delete existing Cookies so previous logins won't remembered
//webView.CoreWebView2.CookieManager.DeleteAllCookies();
// Navigate
webView.CoreWebView2.Navigate(_options.StartUrl);

await semaphoreSlim.WaitAsync();

return browserResult;

Webview suggest me known username (used by this page) but does not ask for password change neither ask to save.

Any suggestion?

@champnic
Copy link
Member

I believe we recently had a regression in the password manager that prevented it from showing. We are working on a fix now, and I'll use this item to track. Thanks!

@champnic champnic added bug Something isn't working and removed question labels Mar 23, 2022
@champnic
Copy link
Member

The fix just went in today, so you should be able to verify it using the latest Microsoft Edge Canary tomorrow.

@champnic champnic self-assigned this Mar 23, 2022
@champnic
Copy link
Member

Fix is available in runtimes v101.0.1203.0+. Thanks!

@gklittlejohn
Copy link

Using runtime 102.0.1245.33 and Microsoft.Web.WebView 1.0.1210.39 it doesn't prompt to save a password (also tried Microsoft.Web.WebView2 1.0.1248-prerelease).

@gklittlejohn
Copy link

gklittlejohn commented Jun 6, 2022

This was an issue with an invalid certificate. This functionality works when the certificate is valid.

@AlbertoCe
Copy link

Hello, this is still not working.
When the form is submitted the login window is closed and there is no way to save the password entered.
Is there any way to ask user to save password ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants