Skip to main content

React Native Quickstart

This guide is for our new Kotlin Multiplatform SDK, which is in Public beta.
This guide walks you through adding Stytch authentication to a React Native app using @stytch/react-native-consumer or @stytch/react-native-b2b. Requirements:

1. Install the SDK


2. Initialize the Client and Wrap Your App

Create the client once at the top level of your app and wrap your component tree with StytchProvider. The client is a singleton; calling createStytchConsumer again returns the same instance.
For B2B apps, swap in createStytchB2B, StytchClientConfiguration, and StytchB2BProvider from @stytch/react-native-b2b. Your public token is in the Stytch Dashboard. Make sure you’ve also enabled the auth methods you want to use under SDK Configuration.

3. Access the Client and State in Components

useStytchUser() and useStytchSession() are convenient shortcuts that return the values directly from the authenticated state — they return undefined when the user is not logged in.

4. Auth Methods

All SDK methods are async and throw on error. Wrap them in try/catch.

SMS OTP Example


Magic links and password reset emails redirect back to your app. Set up React Navigation’s deep linking with your URL scheme, then authenticate the token on arrival:

6. Session Management

Sessions are automatically persisted and validated on startup.

B2B Quick Reference

The B2B package follows the same patterns with B2B-specific names: