Reputation: 1207
So I'm stuck on this weird problem, which somehow I have never experienced before; and somehow I cannot find anything anywhere on how to solve it.
So my problem is this: When I'm logging out with this link
link_to "sign out", destroy_user_session_path, method: :delete
It crashes the application with this message
ActionController::InvalidAuthenticityToken in Devise::SessionsController#destroy
The only other thing I have found here was that this says that someone has already logged out. However, this happens when I have not tried logging out before, nor has the time expired for the user to be logged in.
Is there anyone able to help me?
Upvotes: 4
Views: 1231
Reputation: 36860
The error indicates that the test for cross site request forgery is failing, because of an expired or missing csrf token.
It's worth checking that your layouts/application.html has the =csrf_meta_tag
or <%= csrf_meta_tag %>
as appropriate.
Upvotes: 8