我正在使用google_oauth2宝石来验证使用Google的用户。Google omniauth注销不会删除Rails中的会话('google_oauth2'宝石)
登录和注销工作正常。但是有一个问题。
当用户退出应用程序并尝试使用Google再次登录时,Google会维护用户会话,并且不会再询问Google密码。有什么方法可以销毁Google会话或将超时时间减少到非常低的数量?
我的回调控制器看起来是这样的:
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
def google_oauth2
@user = User.find_for_google_oauth2(request.env["omniauth.auth"], current_user)
if @user.persisted?
flash[:notice] = I18n.t "devise.omniauth_callbacks.success", :kind => "Google"
sign_in_and_redirect @user, :event => :authentication
else
session["devise.google_data"] = request.env["omniauth.auth"]
redirect_to new_user_registration_url
end
end
end
要退出,我使用下面的代码,
def logout
sign_out current_user
session = {}
redirect_to home_page_path
end
你好aadarsh,你是怎么解决这个问题的。它也发生在Omniauth Facebook和Twitter gem上。 – learner 2015-10-26 07:00:17
你好!不幸的是,我无法解决这个问题。我们无法修改其他网站的Cookie(浏览器限制)。一种解决方案是让用户在被卡住时清除他们的Cookie。 我正在iPad主页上开发Web应用程序,并且清除浏览器cookie并未清除Web应用程序容器中的Cookie。我被困在那里。 – aadarshsg 2015-10-27 05:14:05