27

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!

2 Answers 2

74

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.

1
  • 5
    To figure out I didn't need the "extra" section, I used raise request.env["omniauth.auth"].to_yaml
    – dandrews
    Commented Oct 23, 2012 at 23:46
7

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.

3
  • 1
    are there ever any disadvantageous side effects?
    – courtsimas
    Commented Mar 28, 2013 at 22:03
  • I believe you only should use active record store if your session data is bigger than 4K, it's a bit slower than storing it in the cookie. Commented Mar 29, 2013 at 6:39
  • Some out of the box rails open source cms's fail to work with this change, btw...
    – courtsimas
    Commented May 21, 2013 at 21:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.