Search code examples
ruby-on-rails-3deviseomniauthremember-me

Devise + Omniauth + Rememberable


I followed the tutorial on the github devise wiki : https://github.com/plataformatec/devise/wiki/OmniAuth%3A-Overview

So I've created a omniauth controller for the callbacks, but it is bypassing the normal sessions controller and so, the rememberable cookie is not set.

What is the best way for me to fix that ?

Thanks for your help.

EDIT : The Gist from my controller code : https://gist.github.com/913164 So I think the sign in an redirect just set the session cookie, not the rememberable one.

EDIT 2 : I also have a backdoor for dev sign in and avoid FB connect on my local machine :

  def backdoor
        if RAILS_ENV == "development"
            @user = User.first
            @user.remember_me!
            sign_in_and_redirect @user, :event => :authentication
        end
  end

Doesn't work either, so I might have a problem somewhere else.


Solution

  • Damn this is old, sorry to let this stay here this long.

    From my answer in the comments apparently in 11', I forgot to add this:

    @user.remember_me = true
    

    Now let's close this.