title: Omniauth, Devise, Facebook integration guide not working
body: <p>I started up a completely new Rails and Facebook app and followed this <a href="https://github.com/plataformatec/devise/wiki/OmniAuth%3a-Overview" rel="nofollow">guide</a> to the letter.</p>
  
  <p>I can see that a user is getting created and that it even becomes the current_user for the redirect after authentication, however, it doesn't persist. As soon as I hit another controller action, it once again redirects and says I need to sign in.</p>
  
  <p>I'd post my code if I thought any of it would be useful but the only differences between mine and what you see in this wiki ( <a href="https://github.com/plataformatec/devise/wiki/OmniAuth%3a-Overview" rel="nofollow">https://github.com/plataformatec/devise/wiki/OmniAuth%3a-Overview</a> ) are the puts statements in before filters and methods.</p>
  
  <p>I'm not 100% sure how devise with omniauthable works but I do notice that in its <code>self.find_for_facebook_oauth</code> method, it takes in current_user as the 2nd argument and never uses it in the method. In addition, unlike other auth solutions, I don't see it checking for an existing user session anywhere though I believe devise is supposed to take care of this for you.</p>
  
  <h1>Edit</h1>
  
  <p>I'm now pretty sure there is something incredibly wrong with <code>omniauthable</code>. I just added the following to my <code>OmniauthCallbacksController</code></p>
  
  <pre><code>def facebook
    sign_in_and_redirect :user, User.first
  end
  </code></pre>
  
  <p>Essentially this should just login the first user regardless of information. It does and redirects me to a page in my Welcome controller, however, when I try and hit the other action in that controller, I get told once again that I need to sign in. I really have no idea how the current_user is getting lost.</p>