I am using Rails 3.2.3 along with active_record_store for my session.
I understand that the CSRF token in rails is stored in the session and should not be reset unless reset_session is called or for some reason the session is destroyed.
But in some places, when the remote form is loaded via ajax, it contains a different authentication token from the one specified in the META tag on this page. Therefore, you get an invalid token error and reset_session when submitting this form.
def form_authenticity_token session[:_csrf_token] ||= SecureRandom.base64(32) end
I cannot determine the value for a valid session, why is session [: _ csrf_token] destroyed and creates a new token?
source share