Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

GuilhermeSimoes's Profile

GitHub User: GuilhermeSimoes

Comments by GuilhermeSimoes

Avatar

Nevermind, I guess I found the answer to my problem. Here's how I tackled it:

registrations_controller.rb
def build_resource(*args)
  super
  if session["devise.omniauth"]
    @user.apply_omniauth(session["devise.omniauth"])
    session["devise.omniauth"] = nil
  end
end

You should change that session info to nil not after the creation action but immediately after building the resource.

Avatar

I can use facebook omniauth locally. Perhaps your problem lies with your ssl certificate? I had that problem, you can see it's resolution here

Now, I have a question of my own. Using this method described by rbates, if a user successfully authenticates using Twitter which doesn't provide an email, he is taken to the signup page to complete the registration process. Now, if he doesn't complete the registration process, the @user remains in the session (I don't know how) so the next time you try to register, you'll have that authentication method attached to the created user, which could be a completely different user. How do I solve this? Basically, all I need to do is delete the user if I leave the signup page so how do I do that?