The React Native SDK provides the option for you to use pre-built login flows, supporting dark and light themes, with easy configuration, detailed below.
For Email Magic Links, OAuth, SSO, and Password Reset flows, this component handles the deeplinking automatically. You’ll need to add a custom URL scheme and redirect URL as explained below.First, you need to configure your app to listen for a deeplink with the scheme: stytch-ui-[YOUR_PUBLIC_TOKEN]. How you do that will depend on your supported platforms and whether you are using bare React Native or Expo.
If you are using Expo Router, which is the default for new apps created with create-expo-app, you must add a +native-intent.tsx file which ignores the incoming Stytch UI deep links. An example of this can be found here.
Lastly, you’ll need to add a special redirect URL in your Stytch Dashboard Redirect URLs. It should have a URL of stytch-ui-[YOUR_PUBLIC_TOKEN]://deeplink and be applied to all redirect types.Once both the scheme (in your app) and the redirect URL (in your Dashboard) are configured, our pre-built UI should handle the rest.
The products array allows you to specify the authentication methods that you would like to expose to your users.The order of the products that you include here will also be the order in which they appear in the login form, with the first product specified appearing at the top of the login form.Currently the SDK supports our emailMagicLinks, oauth, sso, and passwords products.emailMagicLinks and oauth are supported in both authentication flow types, whereas sso is only supported in the Organization authentication flow type. passwords is always supported in the Organization authentication flow type, but is also supported in the Discovery flow if cross-org passwords are enabled for the project.If the only product specified is oauth, and the only OAuth provider specified is google with one_tap set to true, the login form will not be displayed. Instead, we will only show the Google One Tap prompt in the upper right of the user’s browser.
The authFlowType lets you specify the authentication flow type that you wish to enable in the SDK. The options are Discovery to let Members log into any Organization they are a part of; Organization to let Members log into a specific Organization; and PasswordReset to handle password reset flows (after the user clicks the password reset redirect URL). To enable the Organization flow type, you also must add a slug pattern to the authorized domain through the Frontend SDK page in the Dashboard.
The options for session management. We create a session for Members when they log in. You can access a Member or session using the Member or Session SDK methods.
Set the session lifetime to be this many minutes from now; minimum of 5 and a maximum of 525600 minutes (365 days). Note that a successful authentication will continue to extend the session this many minutes.
Custom template ID for login emails. By default, it will use your default email template. Templates can be added in the Stytch dashboard using our built-in customization options or custom HTML templates with type “Magic links - Login”.
Custom template ID for sign-up emails. By default, it will use your default email template. Templates can be added in the Stytch dashboard using our built-in customization options or custom HTML templates with type “Magic links - Sign-up”.
Custom template ID for password reset emails, configured via the Branding page in the Stytch Dashboard. If this value is not specified, your default password reset template will be used.
Whether or not direct login for single membership is enabled. If the user has an invite or can JIT provision into an Organization the Discovery Organization select pane will still be shown unless the other two properties are also enabled.
If enabled, logs a user directly into their existing Organization even if they have one or more pending invites to a different Organization. This bypasses the Discovery Organization select pane.
If enabled, logs a user directly into their existing Organization even if they have Organizations they could join via JIT provisioning. This bypasses the Discovery Organization select pane.
Whether or not an Organization should be created directly when a user has no memberships, invitations, or Organizations they could join via JIT provisioning. This has no effect if the ability to create Organizations from the frontend SDK is disabled in the Stytch Dashboard. Defaults to false.
Whether to prevent users who are not Members of any Organization from creating a new Organization during the discovery flow. This has no effect if the ability to create Organizations from the frontend SDK is disabled in the Stytch Dashboard. Defaults to false.
The order to present MFA products to a Member when multiple choices are available, such as during enrollment.Currently the SDK supports our smsOtp and totp MFA products.
MFA products to include in the UI. If specified, the list of available products will be limited to those included. Defaults to all available products.Note that if an Organization restricts the available MFA methods, the Organization’s settings will take precedence. In addition, if a Member is enrolled in MFA compatible with their Organization’s policies, their enrolled methods will always be made available.Currently the SDK supports our smsOtp and totp MFA products.