Fork me on GitHub
#om
<
2016-11-11
>
hlolli08:11:02

Wow, css is a deep hole.

danielstockton13:11:16

Can anyone share their methods of dealing with authentication/authorization with om.next? For example, when making requests that require token authorization, where does the token come from? Do you store it in the app-state or as a global variable somewhere? If it's in the app-state, how do you pass the state through to send fn?

danielstockton13:11:00

I feel like it should be part of the app-state, since whether the user is authenticated affects what and how components are rendered

hlolli14:11:16

cemerick https://github.com/cemerick/friend worked great for us. We store users database connection in a atom and handle autorizations from the ring handler. But you can also add user authentiacions in a atom in the backend manually.

danielstockton14:11:59

@hlolli im more interested in the client side actually

danielstockton14:11:29

I was trying to store a JWT token in the app-state that I send with nearly every request, but I couldn't see a way to pass it through the read functions into send

hlolli14:11:06

ok, as friend sends the user a cookie I've never dealt with that. Im interested to learn JWT, just open thought, can't you add it as authorization header in the post function (for example transit-post).

danielstockton14:11:39

Yep, you add it as a header in the post function. My question is basically 'how to get the token to the post function'? I want login to be a mutation that saves a token on to app-state, rather than for the token to be a global variable, because in my mind the app-state should dictate what gets rendered and login status is part of that.

hlolli16:11:43

that's a good question, I guess you need to either a) dereference the atom directly, b) add it as parameter in all reads and get it trough the query which you can access in the post function. Maybe someone knows tricks how to merge this into all parser remote calls. In worst case add this to a cookie, no, dont do that 🙂

deplect20:11:36

Has anyone had any experience adding componentWillMount and ...Unmount to a devcard (not the om.next root to be devcarded). Need to initialize some stoff when card gets mounten and remove when unmounted. Don't find anything in the documentation or source.