2010-05-01 15:22:25 -04:00
|
|
|
= OmniAuth::OAuth
|
|
|
|
|
|
|
|
OAuth 1.0 and 2.0 strategies for the OmniAuth gem.
|
|
|
|
|
|
|
|
== Installation
|
|
|
|
|
2010-06-12 17:16:04 -04:00
|
|
|
To get just OAuth functionality:
|
2010-05-01 15:22:25 -04:00
|
|
|
|
|
|
|
gem install oa-oauth
|
|
|
|
|
|
|
|
For the full auth suite:
|
|
|
|
|
|
|
|
gem install omniauth
|
|
|
|
|
|
|
|
== Stand-Alone Example
|
|
|
|
|
|
|
|
Use the strategy as a middleware in your application:
|
|
|
|
|
|
|
|
require 'omniauth/oauth'
|
|
|
|
|
|
|
|
use OmniAuth::Strategies::Twitter, 'consumer_key', 'consumer_secret'
|
|
|
|
|
|
|
|
Then simply direct users to '/auth/twitter' to have them authenticate via Twitter.
|
|
|
|
|
|
|
|
== OmniAuth Builder
|
|
|
|
|
|
|
|
If you want to allow multiple providers, use the OmniAuth Builder:
|
|
|
|
|
|
|
|
require 'omniauth/oauth'
|
|
|
|
|
|
|
|
use OmniAuth::Builder do
|
|
|
|
provider :twitter, 'consumer_key', 'consumer_secret'
|
|
|
|
provider :facebook, 'app_id', 'app_secret'
|
|
|
|
end
|
|
|
|
|