Esempio n. 1
0
        private async Task LaunchBrowserAsync(string url)
        {
            var appUri = WebAuthenticationBroker.GetCurrentApplicationCallbackUri().AbsoluteUri;

            var result = await WebAuthenticationBroker.AuthenticateAsync(
                WebAuthenticationOptions.None,
                new Uri(url),
                new Uri(appUri));

            if (result.ResponseStatus == WebAuthenticationStatus.Success)
            {
                OidcClient.CaptureRedirectUrl(new Uri(result.ResponseData));
            }
            else if (result.ResponseStatus == WebAuthenticationStatus.UserCancel)
            {
                throw new TaskCanceledException(result.ResponseData);
            }
            else
            {
                throw new Exception(result.ResponseData);
            }
        }