Devise + Omniauth + Rememberable
Asked Answered
G

1

7

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.

Gonroff answered 6/4, 2011 at 9:46 Comment(9)
I don't believe you will be able to use the rememberable cookie using omniauth as oauth is a session based authentication.Cytochemistry
Did you see this SO question/answer?Danielladanielle
Well from omniauth I'm asking for a persistent token, so I save it and create a user, so I do have a "real" devise user to remember.Gonroff
I did, it just doesn't seems to work, I'll add a gist with my controller to show what I'm using.Gonroff
My mistake, I thought this was another answer on stackoverflow that I read already. I'll try that out in a few days, thank you !Gonroff
Alright, it the answer does not fix my problem.Gonroff
Did it or did it not fix your problem?Avidity
Sorry, it did partially. I was missing this: @user.remember_me = trueGonroff
@Gonroff can you answer your own question and accept it so we can clear it out of the queue of unanswered questions please?Newmann
G
2

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.

Gonroff answered 5/6, 2015 at 15:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.