Skip to main content

Migration Guide: @stytch/react-native → stytch-mobile (React Native)

Our new Kotlin Multiplatform SDK is still in Public beta. If you’re looking for a stable version, we recommend using our @stytch/react-native package for the time being.
This guide covers what changed when moving from @stytch/react-native (the original TypeScript-based RN SDK) to @stytch/react-native-consumer / @stytch/react-native-b2b (the new Kotlin Multiplatform-backed SDK).

What Changed at a Glance


New Architecture Requirement

The new SDK uses React Native’s New Architecture (TurboModules), which is the default in RN 0.71+ and mandatory from RN 0.80+. If your project is not yet on the New Architecture, you’ll need to enable it before upgrading.

Installation

Remove the old package from your package.json before adding the new one.

Client Initialization

Before

After

The StytchClientConfiguration constructor takes optional second and third arguments for endpointOptions and defaultSessionDuration.

Hooks

useStytchUser() and useStytchSession()

The old SDK wrapped these values in a SWR object to indicate whether the value was loaded from cache. The new SDK returns the values directly.

useStytch()

Unchanged in name; the returned client type has changed from StytchClient to StytchConsumer, which has a slightly different method surface (see below).

New: useStytchAuthenticationState()

The new SDK adds a dedicated hook for observing full authentication state. This is the replacement for stytch.onStateChange():

Authentication State Observation

Before

After

The StytchProvider handles observation internally — in most cases you don’t need to call the observer directly. Just use the hooks. If you do need to observe outside of React (e.g. in a navigation guard), use authenticationStateObserver:

OTP

Before

After

Key changes:
  • otpsotp
  • method_idmethodId
  • session_duration_minutessessionDurationMinutes
  • authenticate() now takes a single object, not positional arguments


OAuth

The OAuth flow has been simplified. The old SDK returned an intermediate token from start() or startWithRedirect() that you then had to pass to oauth.authenticate(). The new SDK does everything — browser, redirect, token exchange — inside a single start() call.

Before

After

No separate oauth.authenticate() call needed. The start() method accepts a flat parameters object with camelCase keys.

Google OneTap / Google Credential Manager

The old SDK exposed a dedicated stytch.oauth.googleOneTap() method for native Google login. In the new SDK, this is unified into stytch.oauth.google.start() — the SDK automatically uses Google Credential Manager when a GoogleCredentialConfiguration is provided at initialization.
If no GoogleCredentialConfiguration is provided, or if Google Credential manager fails on the user’s device, oauth.google.start() falls back to browser-based OAuth.

Note: Google Credential Manager is only supported in the consumer SDK. Google Credential Manager is not supported in the B2B SDK.


Biometrics

The old SDK required you to call getBiometricRegistrationId() to check whether a registration existed, then branch manually. The new SDK replaces this with getAvailability(), which returns a typed enum, with more explicit statuses.

Before

After

Biometric option parameters have also been restructured:

Session Management


B2B SDK

The B2B SDK has moved from a sub-path export to a fully separate package.
Hook changes mirror the consumer SDK:

Automatic Session Migration

There’s nothing you need to do. On first launch after upgrading, the new SDK automatically reads your users’ existing sessions from the old SDK’s storage and migrates them into the new format. Users who were logged in will remain logged in.