1
0
Fork 0
mirror of https://github.com/omniauth/omniauth.git synced 2022-11-09 12:31:49 -05:00
OmniAuth is a flexible authentication system utilizing Rack middleware.
Find a file
2011-03-10 17:21:26 -06:00
oa-basic Add same-name files for each gem to allow for non-bundled use without custom require. Closes #193 2011-03-01 10:59:54 -06:00
oa-core Add origin setting from param. Closes #218 2011-03-09 11:02:45 -06:00
oa-enterprise Make strategy matching case insensitive. 2011-03-01 13:00:50 -06:00
oa-more Add same-name files for each gem to allow for non-bundled use without custom require. Closes #193 2011-03-01 10:59:54 -06:00
oa-oauth Adds Instapaper and xAuth strategies. Closes #213 2011-03-10 17:21:26 -06:00
oa-openid Add same-name files for each gem to allow for non-bundled use without custom require. Closes #193 2011-03-01 10:59:54 -06:00
omniauth Fixed Gemfile and removed puts. 2011-01-13 18:02:08 -06:00
.document Initial commit to rack-oauthable. 2010-03-25 19:37:03 -04:00
.gitignore Adding a strategy aggregator. 2010-11-15 10:00:05 -06:00
.rspec Upgrade to RSpec 2.0, add universal options hash for strategies, custom paths, closes #54 2010-11-03 13:19:10 -05:00
development_dependencies.rb Added Evernote strategy. 2011-03-03 13:51:05 +01:00
LICENSE Update licenses throughout the gems. 2011-01-05 09:53:29 -06:00
Rakefile Adds oa-more to root Rake tasks, makes specs ready to run 2011-01-12 08:51:22 -06:00
README.markdown Adds Instapaper and xAuth strategies. Closes #213 2011-03-10 17:21:26 -06:00
rspec.watchr Moved 37signals into a single OAuth2 class. 2010-06-23 20:15:43 -04:00
VERSION Bumping version to 0.2.0.beta5 2011-03-01 13:13:45 -06:00

OmniAuth: Standardized Multi-Provider Authentication

OmniAuth is a new Rack-based authentication system for multi-provider external authentcation. OmniAuth is built from the ground up on the philosophy that authentication is not the same as identity, and is based on two observations:

  1. The traditional 'sign up using a login and password' model is becoming the exception, not the rule. Modern web applications offer external authentication via OpenID, Facebook, and/or OAuth.
  2. The interconnectable web is no longer a dream, it is a necessity. It is not unreasonable to expect that one application may need to be able to connect to one, three, or twelve other services. Modern authentication systems should allow a user's identity to be associated with many authentications.

Installation

To install OmniAuth, simply install the gem:

gem install omniauth

Providers

OmniAuth currently supports the following external providers:

Usage

OmniAuth is a collection of Rack middleware. To use a single strategy, you simply need to add the middleware:

require 'oa-oauth'
use OmniAuth::Strategies::Twitter, 'CONSUMER_KEY', 'CONSUMER_SECRET'

Now to initiate authentication you merely need to redirect the user to /auth/twitter via a link or other means. Once the user has authenticated to Twitter, they will be redirected to /auth/twitter/callback. You should build an endpoint that handles this URL, at which point you will will have access to the authentication information through the omniauth.auth parameter of the Rack environment. For example, in Sinatra you would do something like this:

get '/auth/twitter/callback' do
  auth_hash = request.env['omniauth.auth']
end

The hash in question will look something like this:

{
  'uid' => '12356',
  'provider' => 'twitter',
  'user_info' => {
    'name' => 'User Name',
    'nickname' => 'username',
    # ...
  }
}

The user_info hash will automatically be populated with as much information about the user as OmniAuth was able to pull from the given API or authentication provider.

Resources

The best place to find more information is the OmniAuth Wiki. Some specific information you might be interested in:

License

OmniAuth is licensed under the MIT License.