Disable the Dialog Prompt from IOS when implementing Xamarin Essentials Web Authenticator

paulo_carvalho

Paulo Carvalho

Posted on March 8, 2022

Disable the Dialog Prompt from IOS when implementing Xamarin Essentials Web Authenticator

So, i'm currently developing a XamarinForms application with IOS and Android support and Implement openidict for authentication flows.
It turns out that on IOS when opening the browser it prompts with a Dialog first.
While using Xamarin Essentials
In order to disable this dialog one must set PrefersEphemeralWebBrowserSession = true in the WebAuthenticatorOptions as shown below.

var url = new Uri("https://mysite.com/mobileauth/Microsoft");
var callbackUrl = new Uri("myapp://");
var authResult = await WebAuthenticator.AuthenticateAsync(new WebAuthenticatorOptions
    {
        Url = url,
        CallbackUrl = callbackUrl,
        PrefersEphemeralWebBrowserSession = true
    });

Enter fullscreen mode Exit fullscreen mode

I have not tested with anything other than IOS simulators and physical IOS devices.

Hope this helps anyone that tries to find a way to do this as I have found a few people out there asking this question.

💖 💪 🙅 🚩
paulo_carvalho
Paulo Carvalho

Posted on March 8, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related