omniauth--omniauth/README.md

174 lines
7.9 KiB
Markdown
Raw Normal View History

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.
2011-08-13 17:16:53 +00:00
<a name="installation">Installation</a>
------------
To install OmniAuth, simply install the gem:
gem install omniauth
2011-04-23 23:38:22 +00:00
2011-08-13 17:16:53 +00:00
<a name="ci">Continuous Integration</a>
----------------------
[![Build Status](https://secure.travis-ci.org/intridea/omniauth.png)](http://travis-ci.org/intridea/omniauth)
2011-05-03 01:00:54 +00:00
Providers
---------
OmniAuth currently supports the following external providers:
* via OAuth (OAuth 1.0, OAuth 2, and xAuth)
2011-04-25 02:01:22 +00:00
* 37signals ID (credit: [mbleigh](https://github.com/mbleigh))
* Bit.ly (credit: [philnash](https://github.com/philnash))
* Blogger (credit: [dsueiro-backing](https://github.com/dsueiro-backing))
2011-07-19 03:35:45 +00:00
* Cobot (credit: [kamal](https://github.com/kamal))
2011-04-05 15:11:59 +00:00
* DailyMile (credit: [cdmwebs](https://github.com/cdmwebs))
* Doit.im (credit: [chouti](https://github.com/chouti))
* Dopplr (credit: [flextrip](https://github.com/flextrip))
2011-04-24 22:11:49 +00:00
* Douban (credit: [quake](https://github.com/quake))
2011-04-05 15:11:59 +00:00
* Evernote (credit: [szimek](https://github.com/szimek))
2011-04-25 02:01:22 +00:00
* Facebook (credit: [mbleigh](https://github.com/mbleigh))
* Foursquare (credit: [mbleigh](https://github.com/mbleigh))
* GitHub (credit: [mbleigh](https://github.com/mbleigh))
2011-07-01 18:41:43 +00:00
* Glitch (credit: [harrylove](https://github.com/harrylove))
* GoodReads (credit: [cristoffer](https://github.com/christoffer))
2011-05-25 15:45:23 +00:00
* Google Health (credit: [jaigouk](https://github.com/jaigouk))
2011-01-13 03:35:15 +00:00
* Gowalla (credit: [kvnsmth](https://github.com/kvnsmth))
* Hyves (credit: [mrdg](https://github.com/mrdg))
* Identi.ca (credit: [dcu](https://github.com/dcu))
* Flattr (credit: [dcu](https://github.com/dcu))
2011-04-05 15:11:59 +00:00
* Instagram (credit: [kiyoshi](https://github.com/kiyoshi))
* Instapaper (credit: [micpringle](https://github.com/micpringle))
2011-07-20 14:37:00 +00:00
* LastFM (credit: [tictoc](https://github.com/tictoc))
2011-04-25 02:01:22 +00:00
* LinkedIn (credit: [mbleigh](https://github.com/mbleigh))
2011-05-03 01:00:54 +00:00
* Mailru (credit: [lexer](https://github.com/lexer))
2011-01-13 03:35:15 +00:00
* Meetup (credit [coderoshi](https://github.com/coderoshi))
2011-04-05 15:11:59 +00:00
* Miso (credit: [rickenharp](https://github.com/rickenharp))
* Mixi (credit: [kiyoshi](https://github.com/kiyoshi))
2011-01-13 03:35:15 +00:00
* Netflix (credit: [caged](https://github.com/caged))
2011-07-14 13:02:48 +00:00
* Orkut (credit: [andersonleite](https://github.com/andersonleite))
2011-05-18 16:57:54 +00:00
* Plurk (credit: [albb0920](http://github.com/albb0920))
2011-04-24 22:11:49 +00:00
* Qzone (credit: [quake](https://github.com/quake))
2011-05-07 18:55:51 +00:00
* Rdio (via [brandonweiss](https://github.com/brandonweiss))
2011-04-24 22:11:49 +00:00
* Renren (credit: [quake](https://github.com/quake))
* Salesforce (via [CloudSpokes](http://www.cloudspokes.com))
* SmugMug (credit: [pchilton](https://github.com/pchilton))
* SoundCloud (credit: [leemartin](https://github.com/leemartin))
2011-04-24 22:11:49 +00:00
* T163 (credit: [quake](https://github.com/quake))
2011-05-20 18:28:45 +00:00
* Taobao (credit: [l4u](https://github.com/l4u))
2011-04-07 00:48:26 +00:00
* TeamBox (credit [jrom](https://github.com/jrom))
2011-04-24 22:11:49 +00:00
* Tqq (credit: [quake](https://github.com/quake))
2011-03-11 12:09:52 +00:00
* TradeMe (credit: [pchilton](https://github.com/pchilton))
* TripIt (credit: [flextrip](https://github.com/flextrip))
2011-04-24 22:11:49 +00:00
* Tsina (credit: [quake](https://github.com/quake))
* Tsohu (credit: [quake](https://github.com/quake))
2011-04-07 00:48:26 +00:00
* Tumblr (credit: [jamiew](https://github.com/jamiew))
2011-04-25 02:01:22 +00:00
* Twitter (credit: [mbleigh](https://github.com/mbleigh))
2011-08-18 03:02:29 +00:00
* Viadeo (credit: [guillaug](https://github.com/guillaug))
2011-01-30 16:45:32 +00:00
* Vimeo (credit: [jamiew](https://github.com/jamiew))
2011-04-20 17:42:26 +00:00
* Vkontakte (credit: [german](https://github.com/german))
2011-05-27 21:19:25 +00:00
* WePay (credit: [ryanwood](https://github.com/ryanwood))
2011-07-04 01:51:23 +00:00
* Yahoo (credit: [mpd](https://github.com/mpd))
2011-04-25 02:01:22 +00:00
* Yammer (credit: [kltcalamay](https://github.com/kltcalamay))
2011-01-30 16:45:32 +00:00
* YouTube (credit: [jamiew](https://github.com/jamiew))
2011-01-13 03:35:15 +00:00
* CAS (Central Authentication Service) (credit: [jamesarosen](https://github.com/jamesarosen))
2011-03-11 15:31:13 +00:00
* Flickr (credit: [pchilton](https://github.com/pchilton))
2011-04-25 12:25:15 +00:00
* Google Apps (via OpenID) (credit: [mbleigh](https://github.com/mbleigh))
* Google OpenID+OAuth (via Hybrid Protocol) (credit: [boyvanamstel](https://github.com/boyvanamstel))
2011-04-25 12:25:15 +00:00
* LDAP (credit: [pyu10055](https://github.com/pyu10055))
* OpenID (credit: [mbleigh](https://github.com/mbleigh))
* Yupoo (credit: [chouti](https://github.com/chouti))
Compatibility
-------------
2011-04-08 00:34:38 +00:00
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)
2011-04-08 00:34:38 +00:00
* Rubinius
* REE
2011-08-13 17:16:53 +00:00
<a name="usage">Usage</a>
-----
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'
2011-04-23 23:38:22 +00:00
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 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
2010-10-11 16:17:12 +00:00
auth_hash = request.env['omniauth.auth']
end
2011-04-23 23:38:22 +00:00
The hash in question will look something like this:
{
'uid' => '12356',
'provider' => 'twitter',
'user_info' => {
'name' => 'User Name',
'nickname' => 'username',
# ...
}
}
2011-04-23 23:38:22 +00:00
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
---------
2011-05-07 18:55:51 +00:00
The best place to find more information is the [OmniAuth Wiki](https://github.com/intridea/omniauth/wiki). Some specific information you might be interested in:
* [CI Build Status](http://travis-ci.org/intridea/omniauth)
2011-05-07 18:55:51 +00:00
* [Roadmap](https://github.com/intridea/omniauth/wiki/Roadmap)
* [Changelog](https://github.com/intridea/omniauth/wiki/Changelog)
* [Report Issues](https://github.com/intridea/omniauth/issues)
2010-10-19 16:06:21 +00:00
* [Mailing List](http://groups.google.com/group/omniauth)
OmniAuth Core
-------------
2011-04-25 02:01:22 +00:00
* **Michael Bleigh** ([mbleigh](https://github.com/mbleigh))
* **Erik Michaels-Ober** ([sferik](https://github.com/sferik))
2011-08-13 17:16:53 +00:00
<a name="rubies">Supported Rubies</a>
2011-07-27 17:59:21 +00:00
----------------
This library aims to support and is [tested
against](http://travis-ci.org/intridea/omniauth) the following Ruby
implementations:
* Ruby 1.8.7
* Ruby 1.9.2
* [JRuby](http://www.jruby.org/)
* [Rubinius](http://rubini.us/)
2011-08-06 18:21:45 +00:00
* [Ruby Enterprise Edition](http://www.rubyenterpriseedition.com/)
2011-07-27 17:59:21 +00:00
If something doesn't work on one of these interpreters, it should be considered
a bug.
This library may inadvertently work (or seem to work) on other Ruby
implementations, however support will only be provided for the versions listed
above.
If you would like this library to support another Ruby version, you may
volunteer to be a maintainer. Being a maintainer entails making sure all tests
run and pass on that implementation. When something breaks on your
implementation, you will be personally responsible for providing patches in a
timely fashion. If critical issues for a particular implementation exist at the
time of a major release, support for that Ruby version may be dropped.
License
-------
2010-12-29 16:45:48 +00:00
OmniAuth is licensed under the MIT License.