single-sign-on authentication using Facebook on Rails -- AuthLogic or Devise?
I want to create a single sign-on using Facebook (right now) that will not only authenticate but create a new user or login and grab the associated user.
I have seen old version of both a开发者_如何学运维uthlogic and devise being able to use the Facebook Connect javascript to do authentication and user creation, but I believe they depend on Facebooker, which does not use the Graph API (?).
Can someone share 1) the preferred authentication to work with Facebook? I tried Devise on my windows development and the DevKit install is another layer of complexity I'd like to avoid, so hoping Authlogic does the trick; 2) how do enable the single sign on process?
Thanks.
Here are a railscast about devise + omniauth:
simple omniauth
You'll also find on the same website two others railscasts about devise and omniauth.
These days you use oauth2 to auth with facebook. The oauth2 token you get back can be used integrate with the facebook's graph.
The best approach would be to look at the OmniAuth gem. It will allow you to immediately authenticate with facebook (and then tie in twitter, google, yahoo, etc. later). If the documentation is lacking for that gem, then look at the oauth2 gem which will show you exactly how to do it.
Then, when you want to use the facebook graph, look at the fbgraph gem; it is awesome.
I'm using the latest devise from git which doesn't require facebooker, if used with the omniauth gem you can get access to the facebook graph data.
The wiki on the devise github page gives a good overview of what's required to get the integration to work, it shouldn't take more than 30 minutes to get it up and running.
精彩评论