Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug(reducer): auth is empty when using login, but not empty when using createUser #388

Open
mnindrazaka opened this issue Jan 30, 2018 · 11 comments
Assignees
Labels
Milestone

Comments

@mnindrazaka
Copy link

when i tried to use auth with login() and try to shows auth props, i got this
login

but when i use createUser() i got this auth props
createUser

this is my login() code
image

this is my createUser() code
image

and this is how i attach auth props to a component
image

i use react native and react-native-firebase

@yossi-shasho
Copy link

+1
happens to me too, using React web

@ytwater
Copy link

ytwater commented Mar 22, 2018

I'm seeing the same thing.

this.props.firebase.login always seems to be triggering @@reactReduxFirebase/LOGIN_ERROR

For me, I was able to use the standard firebase login and react-redux-firebase still caught the auth change and updated the auth and profile state.

Standard Login

firebase
  .auth()
  .signInWithEmailAndPassword(email, password)
  .then(user => console.log(user));

Credential Login

const credential = firebase.auth.EmailAuthProvider.credential(
  email,
  password
);
firebase
  .auth()
  .signInWithCredential(credential)
  .then(user => console.log(user));

@prescottprue
Copy link
Owner

@ytwater LOGIN_ERROR is dispatched with null to reset error state when logging in.

I'm look into this.

@prescottprue prescottprue self-assigned this Mar 22, 2018
@krzysu
Copy link

krzysu commented Jul 13, 2018

I had the same issue, the problem was the order of functions in redux compose, see example below:

// doesn't work, react-redux-firebase actions are not dispatched
const store = createStore(
  rootReducer,
  compose(
    composeWithDevTools(),
    reactReduxFirebase(firebase, config),
    reduxFirestore(firebase),
    applyMiddleware(thunk.withExtraArgument(getFirebase))
  )
);
// works
const store = createStore(
  rootReducer,
  compose(
    applyMiddleware(thunk.withExtraArgument(getFirebase)),
    reactReduxFirebase(firebase, config),
    reduxFirestore(firebase),
    composeWithDevTools()
  )
);

I hope it helps! :)

@prescottprue
Copy link
Owner

@krzysu Great to know that solves it, thanks for reaching out. Seems like it is caused by the same thing causing #400.

@GioLogist
Copy link

Running into this error on a project of ours currently, tried switching the order of compose and that didn't seem to do the trick either.

@prescottprue
Copy link
Owner

@GioLogist Which version are you using? Did you try installing from the @next tag?

@GioLogist
Copy link

@prescottprue Sorry for the delay - actually fixed it immediately after and forgot to update!

Was my foolish mistake. Forgot to initialize firebase before setting up the store 😝 (was a long day, i swear!)

@gotdibbs
Copy link
Contributor

gotdibbs commented Dec 29, 2018

I'm having the same issue with on v3. It appears as though authActions.init never gets invoked so there is no listener setup for successful logins. I'm not sure where the functionality from enhancer.js is intended to map to in the new version, but that operation and createAuthIsReady seem to be missing currently.

@prescottprue
Copy link
Owner

prescottprue commented Jan 1, 2019

@gotdibbs Thanks for the detailed reporting - I'm going to look into calling that as part of the provider for v3

@prescottprue prescottprue mentioned this issue Jan 1, 2019
3 tasks
prescottprue added a commit that referenced this issue Jan 2, 2019
* fix(typings): add context providers to typings - #564
* fix(storage): support only firestore when calling upload and writing to db - @dirathea
* fix(core): add auth initialization to providers to match v2 store enhancer - #388
@prescottprue
Copy link
Owner

@gotdibbs v3.0.0-alpha.4 now includes auth initialization in the Providers, but I don't believe that addresses this issue, so going to leave it open.

@prescottprue prescottprue added this to the v2.2.* milestone Feb 8, 2019
@prescottprue prescottprue changed the title auth props is empty when use login(), but not empty when use createUser() bug(reducer): auth is empty when using login, but not empty when using createUser Feb 8, 2019
@prescottprue prescottprue modified the milestones: v2.2.*, v3.0.* Feb 9, 2019
@prescottprue prescottprue modified the milestones: v3.0.*, v4.0.0 May 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants