Prevent iOS Consent Boxes for Auth0 React Native SDK and Allow MFA WebAuthn Biometrics as a First Factor
Last Updated:
Overview
When using ephemeral sessions with the Auth0 React Native Software Development Kit (SDK) for iOS, the browser clears persistent cookies each time it closes. This prevents the use of features that rely on persistent cookies, such as MFA WebAuthn Biometrics as a first factor. To resolve this issue and avoid the iOS login and logout consent alert boxes triggered by ASWebAuthenticationSession, configure the application to use SFSafariViewController as the web provider.
Applies To
- Auth0
- Auth0 React Native SDK for iOS
- Multi-Factor Authentication (MFA) WebAuthn Biometrics
Cause
Ephemeral sessions clear cookies upon closing, acting like a private window, causing features that rely on persistent cookies to fail. Additionally, ASWebAuthenticationSession accesses the shared cookie jar, prompting iOS to display login and logout consent alert boxes.
Solution
How can the iOS consent box be prevented while retaining persistent cookies?
Change the web provider in the Auth0 React Native application to SFSafariViewController to persist cookies without accessing the shared cookie jar.
- Review the Auth0.swift User Agents documentation for a breakdown of
ASWebAuthenticationSessionversusSFSafariViewController. - Configure
SFSafariViewControllerin the Auth0 React Native SDK by following the steps outlined in the React Native Auth0 FAQ.
NOTE: SFSafariViewController persists cookies, but does not share them outside the application. Because the application never accesses the shared cookie jar, iOS does not display the login and logout consent boxes, thereby allowing features that depend on persisted browser cookies to function correctly.