Reputation: 1106
I upgraded from Rails 3 to Rails4 and now I am getting InvalidAuthenticityToken error randomly on production only for different actions. I tried to but I can't reproduce it. The params hash contains the authenticity token.
Parameters : {"utf8"=>"✓", "authenticity_token"=>"26+QxdF3aHveYkibn9DJ8Hgz6mUna2v8MOp1bnM78cg=", "session"=>{"email"=>"[email protected]", "password"=>"[FILTERED]"}, "commit"=>"Sign In", "action"=>"create", "controller"=>"sessions"}
Parameters : {"_method"=>"delete", "authenticity_token"=>"uafnPb4DjEJuW9YCTP9UB5tXyGlKbZh6uXlc6MVIoG8=", "controller"=>"sessions", "action"=>"destroy"}
Parameters : {"utf8"=>"✓", "authenticity_token"=>"Nhp4VNI9XJS7yqGRgGewOJ3ilkZSwMhmceXoOsoL/fw=", "volunteer_record"=>{"activity"=>"OTHER", "note"=>"Tuned the Melody Harp -- a tricky little beast....", "hh"=>"", "mm"=>"30"}, "commit"=>"Save", "action"=>"create", "controller"=>"volunteer_records"}
Any clues on how to solve this will be much appreciated. The protect_from_forgery
is set to with: :exception
.
Upvotes: 3
Views: 557
Reputation: 1106
Using
protect_from_forgery: :reset_session
worked for me. This was the default in Rails 3.
Upvotes: 1