-
Notifications
You must be signed in to change notification settings - Fork 157
Can't verify CSRF token authenticity (Rails 4 and below)
Richard Möhn edited this page May 16, 2022
·
1 revision
When authentication fails and you see ‘Can't verify CSRF token authenticity’ in the logs, it's likely that Devise::SamlSessionsController
isn't skipping CSRF protection, even though it contains this line:
skip_before_action :verify_authenticity_token, raise: false
You need to monkey-patch it with another skip_before_action
:
Devise::SamlSessionsController.class_eval do
skip_before_action :verify_authenticity_token
end
This is because the raise: false
above causes the filter not to be skipped in Rails 4, as explained in https://github.com/Shopify/shopify_app/issues/304.
See also: