Devise for Twitter, Cookie Overflow error?

匿名 (未验证) 提交于 2019-12-03 02:45:02

问题:

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!

回答1:

The problem is with session["devise.facebook_data"] = env["omniauth.auth"]. Twitter's response contains an extra section that is very large and does not fit in the session. One option is to store env["omniauth.auth"].except("extra") in the session instead.



回答2:

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

# 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 

Create migration before rails rails g session_migration and migrate it.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!