InvalidAuthenticityToken in Devise::SessionsController#destroy(已经退出后退出) [英] InvalidAuthenticityToken in Devise::SessionsController#destroy (sign out after already having signed out)

查看:15
本文介绍了InvalidAuthenticityToken in Devise::SessionsController#destroy(已经退出后退出)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Devise 3.2.0 进行身份验证,并在执行以下操作时发现问题:

I am using Devise 3.2.0 for authentication and found an issue when I do the following:

  • 标签 1:登录应用
  • 标签 2:转到应用中的任何页面
  • 标签 2:退出退出(成功)
  • 标签 1:注销退出(失败 - 请参阅下面的例外)
  • tab 1: sign in to app
  • tab 2: go to any page in the app
  • tab 2: sign out (success)
  • tab 1: sign out (failure - see exception below)

引发异常:

ActionController::InvalidAuthenticityToken in Devise::SessionsController#destroy

ActionController::InvalidAuthenticityToken in Devise::SessionsController#destroy

在开发日志中我看到:

无法验证 CSRF 令牌的真实性

Can't verify CSRF token authenticity

堆栈跟踪的前三行是:

ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken):
  actionpack (4.0.0) lib/action_controller/metal/request_forgery_protection.rb:163:in `handle_unverified_request'
  actionpack (4.0.0) lib/action_controller/metal/request_forgery_protection.rb:170:in `handle_unverified_request'
  devise (3.2.0) lib/devise/controllers/helpers.rb:198:in `handle_unverified_request'

如何确保连续退出不会引发异常?

How can I ensure successive sign outs don't raise an exception?

推荐答案

此错误已在 devise 3.3.0 中修复.

This bug was fixed in devise 3.3.0.

这篇关于InvalidAuthenticityToken in Devise::SessionsController#destroy(已经退出后退出)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆