/// <summary> /// This is used to handle the callback from the Safari view controller after a user logs in. You need to forward calls to AppDelegate.OpenUrl to this function. Please see the documentation for more information. /// </summary> /// <returns><see langword="true"/> if this url can be handled by an <see cref="OidcClient"/>, or <see langword="false"/> if it is some other url which is not handled by the login flow.</returns> public static bool OpenUrl(UIApplication application, NSUrl url, string sourceApplication, NSObject annotation) { if (OidcClient.CaptureRedirectUrl(new Uri(url.AbsoluteString))) { return(true); } return(false); }
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); } }