Consumer Authentication

/

Mobile SDKs

/

React Native SDK reference

/

Installation

Installation

Install the relevant packages as a project dependency via npm or yarn.

npm install @stytch/react-native @stytch/react-native-inappbrowser-reborn --save

If you are working in a bare workflow in iOS, you will need to run pod install within the ios directory to install the dependencies.

If you are working with Expo, make sure you're running a Development build. Learn more in our migration guides.

Initialize the SDK by creating a new StytchClient object provided in the package. We recommend storing the created client instance in a common file to use it in JavaScript methods such as Redux actions.

StytchClient parameters


public_tokenstring

At the root level of your application, initialize a new StytchProvider object using your public token. To provide all components with access to the StytchClient as well as User and Session data via hooks.

StytchProvider props


stytchStytchClient | null

Example

import { StytchClient, StytchProvider } from '@stytch/react-native';

const stytch = new StytchClient('PUBLIC_TOKEN');

export const App = () => {
  return (
    <StytchProvider stytch={stytch}>
      <Component />
    </StytchProvider>
  );
};