Close ASWebAuthenticationSession Via Links On Universal Login In Auth0

Overview

Developers using the Auth0.swift SDK sometimes need to close the ASWebAuthenticationSession from links on a web page in Universal Login (, even though the close button is displayed on the top-left corner). Resolve this by placing a link with the custom URI scheme used for the Application Callback URLs. When the ASWebAuthenticationSession receives the custom URI scheme, it automatically closes and returns control to the application.

Applies To

  • Auth0
  • Auth0.swift SDK
  • Universal Login
  • ASWebAuthenticationSession

Solution

How is ASWebAuthenticationSession closed via links on Universal Login?

Close the ASWebAuthenticationSession by adding a link with the custom URI scheme used for the Application Callback URLs.

  1. Add an HTML anchor tag to the Universal Login page using the custom URI scheme configured for Application Callback URLs as the href attribute by referencing the following example:
    <a href="com.auth0.samples.swift://close">Close WebView</a>
  2. The Auth0.swift SDK sets the URI scheme configured for the redirect URI to callbackURLScheme. When the ASWebAuthenticationSession receives the custom URI scheme, it automatically closes and returns control to the application.

 

Related References

Recommended content

No recommended content found...