using external browser or webview2
I want to fiddle with OAuth2 protected REST APIs and use a OID Client library that needs an IBrowser implementation to collect the external IDP credentials.
I got that to work in a WPF App but:
How would I do that in LinqPad?
tried roughly like this, but the window remains empty or STA thread errors.
using Microsoft.Web.WebView2.WinForms;
var signinWindow = new System.Windows.Window()
{
Width = 800,
Height = 600,
Title = "Sign In",
WindowStartupLocation = WindowStartupLocation.CenterScreen
};
var webView = new WebView2();
//(....)
signinWindow.Content = webView;
signinWindow.Show();
Comments
-
From your code, it looks like you're trying to add the WinForms WebView2 control to a WPF Window. Try changing the using directive to
using Microsoft.Web.WebView2.Wpf. -
great, you spotted my error!!!

