title: Devise Omniauth, how to link google account
body: <p>I've set up devise to work with omniauth and. This is how devise.rb looks like:</p>
  
  <pre><code>...
    config.omniauth :facebook, FACEBOOK_APP_ID, FACEBOOK_APP_SECRET, :scope =&gt; FACEBOOK_APP_PERMISSIONS
    config.omniauth :openid, OpenID::Store::Filesystem.new('./tmp'), :name =&gt; 'yahoo', :identifier =&gt; 'yahoo.com'
    config.omniauth :openid, OpenID::Store::Filesystem.new('./tmp'), :name =&gt; 'gmail', :identifier =&gt; 'https://www.google.com/accounts/o8/id'
  ...
  </code></pre>
  
  <p>I want to link an existing account with the the above 3, with the following code from the callback controller:</p>
  
  <pre><code>...
    def callback(provider)
      if utilizator_signed_in?
        # link it's account
        if Login.link_omniauth(current_utilizator, omniauth_data)
          flash[:notice] = I18n.t "devise.omniauth_callbacks.link.success", :kind =&gt; provider
          redirect_to :root
        end
      else
        utilizator = Login.auth_with_omniauth(omniauth_data)
  
        if !utilizator.nil?
          flash[:notice] = I18n.t "devise.omniauth_callbacks.success", :kind =&gt; provider
          sign_in_and_redirect utilizator, :event =&gt; :authentication
        else
          utilizator = Login.register_omniauth(omniauth_data)
          flash[:notice] = I18n.t "devise.omniauth_callbacks.register.success", :kind =&gt; provider
          sign_in_and_redirect utilizator, :event =&gt; :authentication
        end
      end
    end
  ...
  </code></pre>
  
  <p>It works just great with facebook, but for google and yahoo the current user get's signed out and a new user is created.</p>
  
  <p>How can I skip the user sign_out phase ?</p>
  
  <p>Thank you,</p>
  
  <p>Edit:
   I am using the latest version 3.0.rc3.
   The functions from Login are easy to guess:
   link_omniauth - will link the current logged user to a account
   auth_with_omniauth - will auth the user
   register_omniauth - will register a new user</p>
  
  <p>The problem here is that utilizator_signed_in? (user_signed_in?) will return false for google when the user is signed in, I think there is a prior sign_out happening that is not happening for facebook.</p>