Skip to content

Setting up your app with the Expo SDK

To set up your app with Privy's Expo SDK, follow the steps below:

1. Install the required dependencies

Core Dependencies

Install the Privy Expo SDK along with its peer dependencies using npm:

npx expo install expo-application expo-constants expo-web-browser expo-linking expo-secure-store react-native-webview expo-crypto @privy-io/expo


Install polyfills which account for APIs required by the Privy Expo SDK that are not available in the React Native environment.

npm i --save fast-text-encoding react-native-get-random-values @ethersproject/shims

If your app uses the Expo bare workflow, the following must also be run.

npx pod install

Polyfills must then be installed and imported as early as possible in your application.


Polyfills must be imported in the correct order to work properly.

import 'fast-text-encoding';
import 'react-native-get-random-values';
import '@ethersproject/shims';

// Your root component

2. Wrap your components with the PrivyProvider

To begin using the Expo SDK in your code, import the PrivyProvider component from the SDK, and wrap the rest of your app's components with it.

As a prop to this component, you must specify an appId which is your Privy App ID from the Privy dashboard.

// Import required polyfils first
import 'fast-text-encoding';
import 'react-native-get-random-values';
import '@ethersproject/shims';

import React from 'react';

// Import the PrivyProvider
import {PrivyProvider} from '@privy-io/expo';

// Your components
import {HomeScreen} from './Homescreen';

export default function App() {
  return (
    // Render the PrivyProvider with your app ID
    <PrivyProvider appId={'insert-your-privy-app-id'}>
      <HomeScreen />


Using Expo 51? Note that Expo 51 has an active bug in their implementation of atob that may prevent Privy's ability to parse and validate a user's access token in your application. You can read more about this issue here and here.

As a temporary workaround for development only, you can patch atob in Expo 51 with the following snippet:

const _atob = atob;
atob = (str: string) => {
  try {
    return _atob(str);
  } catch (e) {
    console.warn(e, 'retrying with padding');
    return _atob(str + '=');