0

I want to integrate facebook with my Ruby on Rails application. the facebook login should be the only way to register on the site.

The information I need to get from facebook is the name and the profile pictures of the users.

What gems/plugins you suggest I use ? (I assume that I will need a gem for the authentication, and a gem for the facebook integration)

Thanks,

Oded

Oded Harth
  • 4,367
  • 9
  • 35
  • 62

2 Answers2

3

I found Devise with the help of Omniauth fairly effective. With a little more patience than I have, you could get things working with just Omniauth.

The devise version that you would need lives on GitHub, and as of the current version, you need a github version of omniauth as well.

From my gemfile:

gem 'devise', :git => 'https://github.com/plataformatec/devise.git'

#oath enables facebook login, for one
gem 'omniauth', :git => 'https://github.com/intridea/omniauth.git'
gem 'oa-oauth', :require => "omniauth/oauth"

#openid enables google login, and openid generally
gem 'oa-openid', :require => 'omniauth/openid'

There's a decent tutorial on one possible way to use Devise with Facebook here: https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview

Facebook will return an email address with sample code provided in the link above; I presume you can ask it for a profile picture as well, though I haven't explored the authorization API much yet.

JasonTrue
  • 19,244
  • 4
  • 34
  • 61
  • 1
    Generally, if you ask for the user's identifier ( in the form of http://graph.facebook.com/jasontrue/picture ) you can get it, so you ask for the Profile_ID in your oath request (the sample only asks for email), you should be able to get what you need. – JasonTrue Mar 05 '11 at 20:31
0

devise/omniauth can be used for authentication. Alternatively look here: Rails 3 facebook plugin/gem?

To interact with facebook API you can need http://facebooker.rubyforge.org/

Community
  • 1
  • 1
Zepplock
  • 28,655
  • 4
  • 35
  • 50