TypeError: Cannot read property 'email' of null
at Object.com$degel$re_frame_firebase$auth$user [as user] (auth.cljs:23)
at com$degel$re_frame_firebase$auth$set_user (auth.cljs:28)
at v.g (auth.js:20)
at gd (auth.js:23)
at ea (auth.js:23)
at wa.x.Ub (auth.js:22)
at le (auth.js:16)

Look like it's failing to do first on the providerData js array. I seem to be logged in and authenticated and everything works.
(-> firebase-user .-providerData first .-email)
firebase.auth().getRedirectResult().then(x => console.log(x))
VM5503:1 {user: null}
Running the above code myself returns a null user which is then passed into the code throwing the error.
https://firebase.google.com/docs/reference/js/firebase.auth.Auth#getRedirectResult
In the docs it says "If no redirect operation was called, returns a UserCredential with a null User."
I think this make sense as the email provider doesn't need to redirect from 3rd party oauth.
Perhaps this code:
(-> (js/firebase.auth)
(.getRedirectResult)
(.then (fn on-user-credential [user-credential]
(-> user-credential
(.-user)
set-user)))
(.catch (core/default-error-handler))))
in com.degel.re-frame-firebase.auth/init-auth can be omitted when using the email provider? If this is the case I'd be happy to submit a PR to fix this.
Look like it's failing to do
firston the providerData js array. I seem to be logged in and authenticated and everything works.(-> firebase-user .-providerData first .-email)Running the above code myself returns a null user which is then passed into the code throwing the error.
https://firebase.google.com/docs/reference/js/firebase.auth.Auth#getRedirectResult
In the docs it says "If no redirect operation was called, returns a UserCredential with a null User."
I think this make sense as the email provider doesn't need to redirect from 3rd party oauth.
Perhaps this code:
in
com.degel.re-frame-firebase.auth/init-authcan be omitted when using the email provider? If this is the case I'd be happy to submit a PR to fix this.