DEV Community

Paulo Carvalho
Paulo Carvalho

Posted on

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.

Top comments (1)

Collapse
 
cchurchill404 profile image
Connor_Churchill

Thanks, this really helped!