diff --git a/src/Auth0.OidcClient.iOS/ASWebAuthenticationSessionBrowser.cs b/src/Auth0.OidcClient.iOS/ASWebAuthenticationSessionBrowser.cs
index a5a65652..eff9ce65 100644
--- a/src/Auth0.OidcClient.iOS/ASWebAuthenticationSessionBrowser.cs
+++ b/src/Auth0.OidcClient.iOS/ASWebAuthenticationSessionBrowser.cs
@@ -12,13 +12,44 @@ namespace Auth0.OidcClient
///
public class ASWebAuthenticationSessionBrowser : IOSBrowserBase
{
+ ///
+ /// Configuration for the ASWebAuthenticationSession.
+ ///
+ public ASWebAuthenticationSessionOptions SessionOptions { get; }
+
+ ///
+ /// Creates a new instance of the ASWebAuthenticationSession Browser.
+ ///
+ /// The specifying the configuration for the ASWebAuthenticationSession.
+ ///
+ /// If any custom browser configuration is needed (e.g. using ),
+ /// a new browser instance should be instantiated and passed to .
+ ///
+ /// var client = new Auth0Client(new Auth0ClientOptions
+ /// {
+ /// Domain = "YOUR_AUTH0_DOMAIN",
+ /// ClientId = "YOUR_AUTH0_CLIENT_ID",
+ /// Browser = new ASWebAuthenticationSessionBrowser(
+ /// new ASWebAuthenticationSessionOptions
+ /// {
+ /// PrefersEphemeralWebBrowserSession = true
+ /// }
+ /// )
+ /// });
+ ///
+ ///
+ public ASWebAuthenticationSessionBrowser(ASWebAuthenticationSessionOptions sessionOptions = null)
+ {
+ SessionOptions = sessionOptions;
+ }
+
///
protected override Task Launch(BrowserOptions options, CancellationToken cancellationToken = default)
{
- return Start(options);
+ return Start(options, SessionOptions);
}
- internal static Task Start(BrowserOptions options)
+ internal static Task Start(BrowserOptions options, ASWebAuthenticationSessionOptions sessionOptions = null)
{
var tcs = new TaskCompletionSource();
@@ -32,9 +63,13 @@ internal static Task Start(BrowserOptions options)
asWebAuthenticationSession.Dispose();
});
- // iOS 13 requires the PresentationContextProvider set
if (UIDevice.CurrentDevice.CheckSystemVersion(13, 0))
+ {
+ // iOS 13 requires the PresentationContextProvider set
asWebAuthenticationSession.PresentationContextProvider = new PresentationContextProviderToSharedKeyWindow();
+ // PrefersEphemeralWebBrowserSession is only available on iOS 13 and up.
+ asWebAuthenticationSession.PrefersEphemeralWebBrowserSession = sessionOptions != null ? sessionOptions.PrefersEphemeralWebBrowserSession : false;
+ }
asWebAuthenticationSession.Start();
diff --git a/src/Auth0.OidcClient.iOS/ASWebAuthenticationSessionOptions.cs b/src/Auth0.OidcClient.iOS/ASWebAuthenticationSessionOptions.cs
new file mode 100644
index 00000000..b772ac1a
--- /dev/null
+++ b/src/Auth0.OidcClient.iOS/ASWebAuthenticationSessionOptions.cs
@@ -0,0 +1,17 @@
+namespace Auth0.OidcClient
+{
+ ///
+ /// Specifies options that can be passed to implementations.
+ ///
+ public class ASWebAuthenticationSessionOptions
+ {
+ ///
+ /// Specify whether or not EphemeralWebBrowserSessions should be preferred. Defaults to false.
+ ///
+ ///
+ /// Setting to true will disable Single Sign On (SSO) on iOS 13+.
+ /// As a consequence of that, it will also prevent from showing the popup that's being used to ask consent for using Auth0 to sign in.
+ ///
+ public bool PrefersEphemeralWebBrowserSession { get; set; }
+ }
+}
diff --git a/src/Auth0.OidcClient.iOS/Auth0.OidcClient.iOS.csproj b/src/Auth0.OidcClient.iOS/Auth0.OidcClient.iOS.csproj
index c96cdaf8..37303a8f 100644
--- a/src/Auth0.OidcClient.iOS/Auth0.OidcClient.iOS.csproj
+++ b/src/Auth0.OidcClient.iOS/Auth0.OidcClient.iOS.csproj
@@ -50,6 +50,7 @@
+
diff --git a/test/iOS/MyViewController.cs b/test/iOS/MyViewController.cs
index 82ae5a4d..97db9ab0 100644
--- a/test/iOS/MyViewController.cs
+++ b/test/iOS/MyViewController.cs
@@ -22,8 +22,13 @@ public override void ViewDidLoad()
_auth0Client = new Auth0Client(new Auth0ClientOptions
{
Domain = "auth0-dotnet-integration-tests.auth0.com",
- ClientId = "qmss9A66stPWTOXjR6X1OeA0DLadoNP2"
- });
+ ClientId = "qmss9A66stPWTOXjR6X1OeA0DLadoNP2",
+ // Optional.
+ // The SDK will determine which browser to use when omitted.
+ // In case you need to specify custom browser configuration,
+ // you should create a new Browser instance and provide it with the corresponding options.
+ Browser = new ASWebAuthenticationSessionBrowser(new ASWebAuthenticationSessionOptions { PrefersEphemeralWebBrowserSession = false })
+ }) ;
LoginButton.Clicked += Login;
UserInfoButton.Clicked += UserInfo;