Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

How to dismiss Essentials.WebAuthenticator iOS window after successful auth?

kanderwellkanderwell Member ✭✭
edited April 8 in Xamarin.Forms

I'm using Xamarin.Essentials.WebAuthenticator for OAuth SSO and it's working great for both iOS and Android to get me authorized, but on iOS the dang ASWebAuthenticationSession window just sits open after the auth succeeds. How do I make it close? I can see that my app gets authed in behind the window and proceeds normally, and if I tap Cancel in the top left of the window it closes and I can go on my merry way, but I don't want my users to have to do that. Am I doing something wrong? If the rest of it is working I can't see how that could be the case. Is this based on the behavior of the particular IDP? My app is obviously catching the redirect just fine and I could just close the window programmatically, but how? And I imagine having to do it myself is not the intended behavior.

For more specifics, I have Universal Links set up (and working) and I'm doing my testing with Github as the IDP.

Best Answer

  • kanderwellkanderwell Member ✭✭
    Accepted Answer

    I figured out I can do this:

    var safariVc = Platform.GetCurrentUIViewController() as SFSafariViewController;
    safariVc?.DismissViewController(true, () => { });
    

Answers

  • kanderwellkanderwell Member ✭✭
    Accepted Answer

    I figured out I can do this:

    var safariVc = Platform.GetCurrentUIViewController() as SFSafariViewController;
    safariVc?.DismissViewController(true, () => { });
    
  • Carl_RCarl_R SEMember ✭✭

    How do you use the access_token after you are authenticated?

Sign In or Register to comment.