Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 authlogic 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.

like image 818
Satchel Avatar asked Nov 26 '10 16:11

Satchel


3 Answers

Here are a railscast about devise + omniauth:

simple omniauth

You'll also find on the same website two others railscasts about devise and omniauth.

like image 127
Pasta Avatar answered Oct 14 '22 22:10

Pasta


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.

like image 2
Aaron Scruggs Avatar answered Oct 14 '22 23:10

Aaron Scruggs


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.

like image 2
jonnii Avatar answered Oct 14 '22 21:10

jonnii