10

I would like to connect to those applications which provided OAuth API (such as fb, twitter).

Is there a relatively easier way to integrate those APIs?

I have successfully used linkedin gem which can connect to LinkedIn OAuth API. But I really don't want to install a gem for dealing with a single application, where those applications provided similar OAuth APIs.

PeterWong
  • 15,951
  • 9
  • 59
  • 68

4 Answers4

7

Since Oct 2010, someone has come up with a gem called OmniAuth. It packages together a number of different identity providers into a Rack middleware. It specifically does not handle authorization or persistence -- that is left up to you. It's probably the best option out right now, especially if you don't plan on using classic username/password authentication (though OmniAuth can handle it).

OmniAuth will handle identification from Facebook, Twitter, Google, LinkedIn, 37Signals, and Github. See below for a complete list as of this posting.

Since this is a Rack middleware, it is possible to use this with Devise and AuthLogic. Because of its modularity, it should be easy to use this with pure-Restful-API Rails/Sinatra apps (no direct HTML rendering) that talk to mobile apps that is gaining in popularity without pulling in the extra code from Devise and AuthLogic.

The best tutorial for getting started is the blog post written for Rails Rumble on getting authentication up and running quickly: http://blog.railsrumble.com/blog/2010/10/08/intridea-omniauth

Ryan Bates also has a few Railscasts about OmniAuth:

As of this posting, these are the following providers coming out of the box (based on https://github.com/intridea/omniauth/tree/dc44c54d80ca0b49d1f63bbbf21165a7515fd41d)

OAuth/OAuth2:

  • bitly
  • dailymile
  • doit
  • dopplr
  • evernote
  • facebook
  • foursquare
  • github
  • goodreads
  • google
  • gowalla
  • hyves
  • identica
  • instagram
  • instapaper
  • linked_in
  • meetup
  • miso
  • mixi
  • netflix
  • smug_mug
  • sound_cloud
  • 37 Signals
  • trade_me
  • trip_it
  • twitter
  • type_pad
  • vimeo
  • xauth
  • yahoo
  • you_tube

OpenId:

  • Google App (Marketplace integration)
  • Generic OpenID

HTTP Basic:

  • 37 Signals Campfire
  • 37 Signals Basecamp
  • Generic HTTP Basic auth

Enterprise:

  • Central Authentication Service (CAS)
  • LDAP

Other:

  • Windows Live
  • Flickr
Ho-Sheng Hsiao
  • 1,327
  • 12
  • 10
5

if you happen to have an existing user authentication infrastructure in your app or if you're just not using Authlogic (and do not want to use it), OmniAuth might help You.

https://github.com/intridea/omniauth

Here are some resources to get You started :

http://blog.railsrumble.com/blog/2010/10/08/intridea-omniauth

http://railscasts.com/episodes/235-omniauth-part-1

http://railscasts.com/episodes/236-omniauth-part-2

kares
  • 7,076
  • 1
  • 28
  • 38
  • 1
    +1 Thank you. The question has been posted long time ago and I actually am using this great gem :D Your answer would probably benefits those who have the same problem with me :D – PeterWong Jan 04 '11 at 02:51
  • Yes I know it's an old q, I just wanted the answer to be more up to date as it showed in search results, besides it's not that easy to discover this excellent authentication gem ... I almost went with AuthLogic :) – kares Jan 04 '11 at 07:10
  • Can't agree more! I am addicted to AuthLogic and probably won't go to devise / authlogic as omniauth gave what I need easily. – PeterWong Jan 05 '11 at 03:44
4

Well, both fb and twitter are pretty custom versions of OAuth, so I think you'll end up needing a gem per app. But!

Authlogic provides some nice plugins for open-id, twitter, and facebook.

Community
  • 1
  • 1
Jesse Wolgamott
  • 40,197
  • 4
  • 83
  • 109
3

AuthlogicConnect looks like it works for many sites (Twitter, Facebook, LinkedIn, MySpace, Google, Yahoo). I'm currently using it with FB and Twitter on Rails 3. Be sure to follow the tutorial as there are many things to set up.

Daniel X Moore
  • 14,637
  • 17
  • 80
  • 92