DEV Community

Paulo Carvalho
Paulo Carvalho

Posted on

4 1

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.

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (1)

Collapse
 
cchurchill404 profile image
Connor_Churchill

Thanks, this really helped!

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay