Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

omniauth vs. oauth-plugin

I'm trying to figure out the differences between omniauth (https://github.com/intridea/omniauth) and oauth-plugin - (https://github.com/pelle/oauth-plugin)

I'm simply looking for a way to allow my users to authenticate with (Twitter, Facebook, etc) within my app.

I know omniauth provides this, but I'm running rails 2.3.10 which I don't believe is supported by omniauth. Can I use oauth-plugin? It also seems to have a lot fewer dependencies. Any thoughts are appreciated.

like image 354
Jim Jones Avatar asked Jul 16 '11 05:07

Jim Jones


1 Answers

I have to disagree with the previous answers.

oauth-plugin is

a plugin for implementing OAuth Providers and Consumers in Rails applications. 1

It provides two generators (one for implementing an OAuth provider, one for the consumer) which create the models, the views and the controllers. The way the controllers work, is that they are subclasses of controllers defined in the gem. It's tied into Rails pretty deeply, and can only do OAuth.

omniauth, on the other hand, is a modular, framework-agnostic library that allows you to provide authentication via a multitude of providers.

Concretely, it means that you set up two endpoints (/auth/:provider and /auth/:provider/callback), have your user authenticate with the provider, and receive a hash with the user's info in return.

TL;DR

If you only need to provide authentication via Facebook/Twitter/OAuth/etc (i.e. you want to be an OAuth consumer), then omniauth is definitely more lightweight.

If you want to run an OAuth provider, oauth-plugin might be more straightforward, but it tends to be a lot more bloated, in my opinion, since it injects a lot of boiler-plate code into your app.

like image 103
asymmetric Avatar answered Oct 08 '22 02:10

asymmetric