I started up a completely new Rails and Facebook app and followed this guide to the letter.
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.
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 ( https://github.com/plataformatec/devise/wiki/OmniAuth%3a-Overview ) are the puts statements in before filters and methods.
I’m not 100% sure how devise with omniauthable works but I do notice that in its self.find_for_facebook_oauth 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.
Edit
I’m now pretty sure there is something incredibly wrong with omniauthable. I just added the following to my OmniauthCallbacksController
def facebook
sign_in_and_redirect :user, User.first
end
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.
There are very few resources on how to use Devise’s omniauthable module. You might want to have a look at https://gist.github.com/993566 and http://edmiston.id.au/post/9204306833/omniauthable-my-version . The wiki is missing a few details.