我正在使用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