设计Twitter,Cookie溢出错误?
我正在尝试使用本指南将twitter集成到设计中。 我基本上把所有出现的facebook都用twitter取而代之。 但是,当我使用Twitter登录时,我收到以下错误:
ActionDispatch::Cookies::CookieOverflow (ActionDispatch::Cookies::CookieOverflow):
在以下url:
http://localhost:3000/users/auth/twitter/callback?oauth_token=something&oauth_verifier=blah
有什么好方法可以解决这个问题吗?
谢谢!
问题在于session["devise.facebook_data"] = env["omniauth.auth"]
。 Twitter的回复包含一个非常大的extra
部分,不适合会话。 一种选择是在会话中存储env["omniauth.auth"].except("extra")
。
您可以打开ActiveRecord商店进行会话。 查看config / initializers / session_store.rb
注释掉有关使用的行:cookie_store
取消注释底部使用的行:active_record_store
# Use the database for sessions instead of the cookie-based default, # which shouldn't be used to store highly confidential information # (create the session table with "rails generate session_migration") MyApp::Application.config.session_store :active_record_store
在rails rails g session_migration
之前创建迁移并迁移它。