As indicated in Devise documentation notes for Rails 5
For Rails 5, note that
protect_from_forgery
is no longer prepended
to thebefore_action
chain, so if you have setauthenticate_user
beforeprotect_from_forgery
, your request will result in “Can’t
verify CSRF token authenticity.” To resolve this, either change the
order in which you call them, or useprotect_from_forgery prepend:
.
true