Fork me on GitHub

Has anyone tried using re-frame’s event loop as a standalone component for a server side app? I’m trying to look for a robust solution for dispatching and running events, and it on first glance it seemed the EventQueue might be a good candidate.


Hi, I’m still working through my re-frame/auth0 integration, and while the login piece is now working (the auth0 redirect is happening and I can login/signup using that functionality), I am struggling to figure out how to store the user’s status in the re-frame db once the user has logged in. I have a (working) login button like so:

(defn login-button
      (let [login (.-loginWithRedirect (useAuth0))]
           [:button {:className class-name
                     :on-click (fn []
                                   (login))} "Login"])
Now, what I would expect is to have some sort of callback in the useAuth0 component that I could then use to check that the user has in fact logged in successfully - and I think that does indeed exist, in the guise of the useAuth0.isAuthenticated attribute (there is also an useAuth0.isLoading attribute which I’ll need to monitor as well to ensure that the page is fully loaded before checking isAuthenticated I presume). Where I’m struggling is figuring out where exactly I should actually do this ‘check if loaded -> check if authenticated -> stuff the user in local db using rf/dispatch’ work. As it stands, my login button is on a public webpage public-splash (which I refer to from a simple nav component, like so:
(defn nav
      (let [logged-in? @(rf/subscribe [:logged-in?])
           (if sub
So what I would like to happen is for the logged-in? sub (which is really simple - it is
  (fn [db]
      (not (nil? (get-in db [:user :sub])))
to dynamically choose to go to either the public splash page or the user dashboard depending on whether the user is logged in - but I’m not sure where to deal with the login event itself. Any advice gratefully accepted.


I would argue strongly against using auth0-react. It ties in authentication/authorization to your UI, which conceptually makes exactly 0 sense. There's probably a regular JS library that allows you to have full control over what you do and when you do it - use that instead. Put it behind a nice effect and you there you have it.


ok, thanks for the advice. You could be right given the messing around I’ve been doing to try to make this work.