Windows security popup appears behind the main application window

Viewed 678

I am using Windows 10 APIs "Passport" & "Window Hello" in my WPF application.

bool keyCredentialAvailable = await KeyCredentialManager.IsSupportedAsync();
if (keyCredentialAvailable)
{
      KeyCredentialRetrievalResult keyCreationResult = await KeyCredentialManager.RequestCreateAsync("Hi", KeyCredentialCreationOption.ReplaceExisting);

}

RequestCreateAsync method opens the popup which asks for biometric or pin. Which is visible in the screenshot at the back of MainWindow.

I don't have any reference for this Popup that I can bring it in front. Also, I am calling this method on my MainWindow's Loaded method so that it can be confirmed that Main window is loaded fully.

Issue with Popup positioning Issue Right now

Expected Positioning Expected

2 Answers

First, check whether your function is async.

private async void SignInPassport()
{
 bool keyCredentialAvailable = await KeyCredentialManager.IsSupportedAsync();
 if (keyCredentialAvailable)
 {
  KeyCredentialRetrievalResult keyCreationResult = await KeyCredentialManager.RequestCreateAsync("Hi",KeyCredentialCreationOption.ReplaceExisting);
  }
}

if this does not solve your issue try this microsoft-passport-login

I filed a Github issue with Microsoft's C++/WinRT project, which I use to access the same API, and face the problem.

https://github.com/microsoft/cppwinrt/issues/999#issuecomment-897675623

No solution, but "This usually happens when the parent window isn't set correctly." I have no idea how to set the parent window correctly in this case, as the API does not expose any handles on the popup.

Related