Safari Remains as Current Active App after Authentication if useEphemeralSession is Used

Problem statement

After login, the application is NOT activated, and control remains with Safari if the following conditions are met:

  1. The system is running MacOS.
  2. Safari is the system’s default browser. The issue cannot be reproduced with the Chrome browser.
  3. The application uses Auth0.Swift SDK to initiate the login: Auth0.swift.
  4. useEphemeralSession is enabled: Use ephemeral sessions.

Cause

This is a macOS issue and is out of the control of the Auth0.Swift SDK.

Auth0.Swift SDK defers to Apple’s API for web-based authentication (ASWebAuthenticationSession` `), which handles opening the browser, receiving the callback URL, and passing it back to the SDK, etc. As described in the document [How can I disable the login alert box?](https://github.com/auth0/Auth0.swift/blob/master/FAQ.md#1-how-can-i-disable-the-login-alert-box), the `useEphemeralSession()` sets the `prefersEphemeralWebBrowserSession` configuration option of ASWebAuthenticationSession to true.

The behavior of making the application active after the user completes the login in the browser is controlled by the macOS, namely the Apple API ``ASWebAuthenticationSession .

Solution

Auth0 has reported the issue to Apple, and Apple confirmed the issue but has not confirmed when it will be fixed.