OmniAuth is a flexible authentication system utilizing Rack middleware.
Перейти к файлу
lexer 5d15e99649 add empty user data 2011-04-29 12:00:18 +06:00
lib New versioning system to support testing on http://test.rubygems.org/ 2011-04-22 11:41:33 -05:00
oa-basic Add jruby-openssl dependency 2011-04-27 14:27:49 -07:00
oa-core Refactor of strategy.rb to break up the call! and mock_call! methods to be less monolithic. Also closes #259 2011-04-25 11:42:11 -05:00
oa-enterprise Add jruby-openssl dependency 2011-04-27 14:27:49 -07:00
oa-more Add jruby-openssl dependency 2011-04-27 14:27:49 -07:00
oa-oauth add empty user data 2011-04-29 12:00:18 +06:00
oa-openid Add jruby-openssl dependency 2011-04-27 14:27:49 -07:00
.autotest Replace watchr with autotest 2011-04-22 13:13:24 -05:00
.document Initial commit to rack-oauthable. 2010-03-25 19:37:03 -04:00
.gemtest Gem dependency refactor 2011-04-22 02:52:52 -05:00
.gitignore Adding a strategy aggregator. 2010-11-15 10:00:05 -06:00
.rspec Switch to progress format to make Travis builds easier to read etc. 2011-04-25 10:22:29 -05:00
.travis.yml Evernote should work on JRuby 1.6.1. 2011-04-27 13:58:06 -07:00
.yardopts Gem dependency refactor 2011-04-22 02:52:52 -05:00
Gemfile Oops. Use the public git URL. 2011-04-27 16:34:07 -07:00
LICENSE Update licenses throughout the gems. 2011-01-05 09:53:29 -06:00
README.markdown Yupoo is not an OAuth provider 2011-04-25 05:25:15 -07:00
Rakefile Possibly fix rspec error on travis build. 2011-04-25 20:06:01 -05:00
VERSION New versioning system to support testing on http://test.rubygems.org/ 2011-04-22 11:41:33 -05:00
omniauth.gemspec New versioning system to support testing on http://test.rubygems.org/ 2011-04-22 11:41:33 -05:00

README.markdown

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:

Compatibility

OmniAuth is tested against the following Ruby versions:

  • 1.8.7
  • 1.9.1
  • 1.9.2
  • jRuby (note, the Evernote strategy is not available for jRuby)
  • Rubinius
  • REE

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:

OmniAuth Core

License

OmniAuth is licensed under the MIT License.