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.

Xamarin.Essentials.Browser.Openasync is not closing after activity in iOS

RichyRichy Member ✭✭
edited July 7 in Xamarin.Forms

When Auth0 URL is passed to Xamarin.Essentials.Browser.Openasync to open the browser, after authentication in android Callback url is handled and continuing to corresponding ContentPages. But in iOS i'm getting the callback from OpenUrl function in AppDelegate but the browser is not closing. And even if we forcibly dismiss the ViewController of browser, Still the navigation to corresponding ContentPages is not happening. But can see the compiler is going through corresponding codes while debugging and the view is not appearing.


  • ColeXColeX Member, Xamarin Team Xamurai

    The issue is reported here : .

    Xamarin.Essentials.Browser use SFSafariViewController , but SFSafariViewController does not close automatically on iOS when receiving auth url, to solve it you could refer to the workaround , use dependency service to close the viewcontroller manually in code .

    [assembly: Xamarin.Forms.Dependency(typeof(Xamarin.iOS.Services.PlatformBrowserService))]
    namespace Xamarin.iOS.Services
        public class PlatformBrowserService : IPlatformBrowserService
            public Task CloseBrowser()
                var window = UIApplication.SharedApplication.KeyWindow;
                var vc = window.RootViewController;
                return vc.DismissViewControllerAsync(false);


      if (DeviceInfo.Platform == DevicePlatform.iOS)
                var service = DependencyService.Resolve<IPlatformBrowserService>();
                await service.CloseBrowser();
Sign In or Register to comment.