Open CalebMacdonaldBlack opened 6 years ago
This sounds reasonable, but I'm not setup to easily test email login. Bringing @wneirynck into the conversation to comment, since he wrote the email support.
I'll have to look into it, but at first sight the code is not directly related to the email issue. But maybe, as a result of enabling the email authentication possibility, the redirect code is also invoked. I'll check it out.
Also, maybe I'm seeing it incorrectly, but I think the init-auth
function is never called.
In PR #19 , I changed the parsing code for set-user
to read like this:
:email (let [provider-data (.-providerData firebase-user)]
(when-not (empty? provider-data)
(-> provider-data first .-email)))}))
which was required, as not all auth flow returns with a non-empty providerData array. Think this solves the symptom of the problem, at least?
Look like it's failing to do
first
on the providerData js array. I seem to be logged in and authenticated and everything works.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-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.