HomeProjectsBlog

Persisting firebase auth in expo

February 25, 2025

Inorder to import getReactNativePersistence , you should map the @firebase/auth module to React Native-specific declaration file

{
  "compilerOptions": {
    "paths": {
      "@firebase/auth": ["./node_modules/@firebase/auth/dist/index.rn.d.ts"]
    }
  },
  "extends": "expo/tsconfig.base"
}
import {
  getReactNativePersistence,
  initializeAuth,
} from "firebase/auth";


const auth = initializeAuth(app, {
  persistence: getReactNativePersistence(AsyncStorage),
});

Happy coding.