简体   繁体   中英

Rails Devise - Logout error ActionController::InvalidAuthenticityToken

I am using Devise and trying to build the Logout link to logout of the user session.

I have included jquery-ujs file in the template and its loading correctly.

This is my Logout link

<%= link_to "Sign Out", destroy_user_session_path, :method => :delete %>

But when i click the link i am getting the following error

ActionController::InvalidAuthenticityToken at /users/sign_out

ActionController::InvalidAuthenticityToken

If you need the authenticity token, then provide it.

<%= form_tag destroy_user_session_path, method: :delete do |f| %>
  <%= f.submit 'Sign Out' %>
<% end %>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM