internal async static Task <string> AuthenticateAsync(Uri requestUri, Uri callbackUri) { var broker = new WebAuthBrokerOld(); //CoreApplicationView newView = CoreApplication.CreateNewView(); //int newViewId = 0; //await newView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => //{ // Frame frame = new Frame(); // frame.Navigate(typeof(TransfersPage)); // var c = frame.Content; // Window.Current.Content = frame; // newViewId = ApplicationView.GetApplicationViewIdForWindow(newView.CoreWindow); //}); //bool viewShown = await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newViewId); var tcs = new TaskCompletionSource <string>(); broker.MainWebView.NavigationStarting += (sender, e) => { var uriString = e.Uri.ToString(); if (uriString.StartsWith(callbackUri.OriginalString)) { tcs.SetResult(e.Uri.OriginalString); } }; broker.MainWebView.Navigate(requestUri); return(await tcs.Task); }
internal async static Task<string> AuthenticateAsync(Uri requestUri, Uri callbackUri) { var broker = new WebAuthBrokerOld(); //CoreApplicationView newView = CoreApplication.CreateNewView(); //int newViewId = 0; //await newView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => //{ // Frame frame = new Frame(); // frame.Navigate(typeof(TransfersPage)); // var c = frame.Content; // Window.Current.Content = frame; // newViewId = ApplicationView.GetApplicationViewIdForWindow(newView.CoreWindow); //}); //bool viewShown = await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newViewId); var tcs = new TaskCompletionSource<string>(); broker.MainWebView.NavigationStarting += (sender, e) => { var uriString = e.Uri.ToString(); if (uriString.StartsWith(callbackUri.OriginalString)) tcs.SetResult(e.Uri.OriginalString); }; broker.MainWebView.Navigate(requestUri); return await tcs.Task; }