[英]Rails Devise - Logout error ActionController::InvalidAuthenticityToken
I am using Devise and trying to build the Logout link to logout of the user session. 我正在使用Devise,并尝试构建注销链接以注销用户会话。
I have included jquery-ujs file in the template and its loading correctly. 我已经在模板中包含了jquery-ujs文件,并且其加载正确。
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 %>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.