prescottprue / react-redux-firebase

Redux bindings for Firebase. Includes React Hooks and Higher Order Components.
https://react-redux-firebase.com
MIT License
2.55k stars 559 forks source link

feat(auth): add support for useEmulator #1060

Closed benomatis closed 3 years ago

benomatis commented 3 years ago

Looks like Auth now has emulator support, would be great to see it in this package as well.

prescottprue commented 3 years ago

This is actually within the firebase instance instead of react-redux-firebase. You should be able to just use that method as you are initializing your firebase instance before passing to react-redux-firebase. Here is a version of the same code in the use section of the README that includes that:

// react-redux-firebase config
const rrfConfig = {
  userProfile: 'users'
  // useFirestoreForProfile: true // Firestore for Profile instead of Realtime DB
}

// Initialize firebase instance
firebase.initializeApp(fbConfig)

firebase.auth().useEmulator('http://localhost:9099/'); // enable auth emulator

// THEN LATER

const rrfProps = {
  firebase, // passing firebase instance which is already pointed to auth emulators
  config: rrfConfig,
  dispatch: store.dispatch
  // createFirestoreInstance // <- needed if using firestore
}

Reach out if things aren't working as you expect