为 Twitter 设计,Cookie 溢出错误?
我正在尝试使用此指南将twitter集成到devise中。我基本上把所有出现的facebook 都用twitter 代替。但是,当我使用 Twitter 登录时,出现以下错误:
ActionDispatch::Cookies::CookieOverflow (ActionDispatch::Cookies::CookieOverflow):
在以下网址:
http://localhost:3000/users/auth/twitter/callback?oauth_token=something&oauth_verifier=blah
有什么好的方法可以解决此问题吗?
谢谢!
I am trying to integrate twitter into devise using this guide. I basically take all occurence of facebook and substitue it with twitter. However, when I sign in with twitter, I am getting the following error:
ActionDispatch::Cookies::CookieOverflow (ActionDispatch::Cookies::CookieOverflow):
at the following url:
http://localhost:3000/users/auth/twitter/callback?oauth_token=something&oauth_verifier=blah
Is there any nice way to get around fixing this problem?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
问题出在
session["devise.facebook_data"] = env["omniauth.auth"]
上。 Twitter 的响应包含一个非常大且不适合会话的extra
部分。一种选择是将env["omniauth.auth"]. except("extra")
存储在会话中。The problem is with
session["devise.facebook_data"] = env["omniauth.auth"]
. Twitter's response contains anextra
section that is very large and does not fit in the session. One option is to storeenv["omniauth.auth"].except("extra")
in the session instead.您可以为会话打开 ActiveRecord 存储。
查看 config/initializers/session_store.rb
注释掉有关使用 :cookie_store 的行
,取消注释底部有关使用 :active_record_store 的
行 在rails
rails g session_migration
之前创建迁移并迁移它。You can turn on ActiveRecord store for session.
Look in config/initializers/session_store.rb
comment out the line about using :cookie_store
uncomment the lines at the bottom about using :active_record_store
Create migration before rails
rails g session_migration
and migrate it.