-
Notifications
You must be signed in to change notification settings - Fork 8
Description
Hi Team,
I am trying to open webview in windows forms and i am using below versions of
and below code to load ADFS Url in webview so that user can key in username,password to authorize
Hi,
I am trying to load windows forms app if the user is succesfully logged into AD, For the same i am using
.NetCore3 preview 4
In Windows forms
var authResult = authContext.AcquireTokenAsync(resourceURI, clientID,
new Uri(clientReturnURI),
new PlatformParameters(PromptBehavior.Always, new CustomWebUi(SynchronizationContext.Current))); //Dispatcher.CurrentDispatcher
In
CustomWebUI Class
class CustomWebUi : ICustomWebUi
{
private readonly SynchronizationContext _dispatcher;
public CustomWebUi(SynchronizationContext dispatcher)
{
_dispatcher = dispatcher ?? throw new ArgumentNullException(nameof(dispatcher));
}
public Task AcquireAuthorizationCodeAsync(Uri authorizationUri, Uri redirectUr)
{
var tcs = new TaskCompletionSource();
_dispatcher.Send(_ =>
{
//anything you wish.
var webView = new WebView();
webView.
var w = new Window
{
Title = "Auth",
WindowStyle = WindowStyle.ToolWindow,
Content = webView,
};
w.Loaded += (sender, args) => webView.Navigate(authorizationUri);
w.Loaded += (sender, args) => webView.NavigateToString("<title>sfsdf</title>");
if (w.ShowDialog() != true && !tcs.Task.IsCompleted)
{
tcs.SetException(new Exception("canceled"));
}
}, null);
}
}
When i load it, It gives me below error. Can you please let me know where am i going wrong.
Thanks!

