Fork me on GitHub

Hey, looking for some advice on handling a changing anti-forgery token between ajax requests. Right now, I'm initially loading the value into an atom, and then reset!ing that value based on a response header I'm populating. It's not working horribly well, though, the token still ends up getting rejected at some point, and I can't figure out why.


If that happens only after you hot reload your code during development, it might be that you're using def instead of defonce. Apart from that, no idea.


let me see if that helps


I didn't exactly figure it out, but I found a way to make everything simpler, which made the problem go away. I was updating the session in an ajax request, which I think was causing the token to change. When I changed things around so all that information was in the session when the SPA initially loads, everything worked a lot smoother.

👍 4