Getting session authenticity token via ajax (rails, jquery)
- by ming yeow
Hi folks, I wish to authenticate a user without having the page reloaded, and having the user submit a given form.
However, the problem that I immediately run into here is that the authenticity token typically gets set when the page is reloaded.
I need the authenticity token for the form submission, but i do not have it yet because the page is yet to reload.
I figure this cannot be that rare - anyone has any idea on how to resolve this?
1 idea could be getting rails to pass back the authenticity token after authentication, but i do not know how to access it from the controller
1) not logined user sees form
2) not logined user types in message and submit
3) facebox asking for authentication
4) after authentication, submit form automatically without refreshing
5) //but authenticity token is needed for form submission, which is not there yet