Created
September 28, 2011 16:08
-
-
Save mbleigh/1248352 to your computer and use it in GitHub Desktop.
How to use OmniAuth 1.0 RIGHT. NOW.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'bundler' | |
Bundler.setup :default | |
require 'sinatra' | |
require 'omniauth' | |
require 'omniauth-contrib' | |
use Rack::Session::Cookie | |
use OmniAuth::Builder do | |
provider :twitter, ENV['TWITTER_KEY'], ENV['TWITTER_SECRET'] | |
end | |
get '/' do | |
<<-HTML | |
<ul> | |
<li><a href='/auth/twitter'>Sign in with Twitter</a></li> | |
</ul> | |
HTML | |
end | |
get '/auth/:provider/callback' do | |
content_type 'text/plain' | |
request.env['omniauth.auth'].inspect | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'sinatra' | |
gem 'omniauth', '~> 1.0.0.alpha', :git => 'git://github.com/intridea/omniauth.git' | |
gem 'omniauth-oauth', '~> 1.0.0.alpha', :git => 'git://github.com/intridea/omniauth-oauth.git' | |
gem 'omniauth-contrib', '~> 1.0.0.alpha', :git => 'git://github.com/intridea/omniauth-contrib.git' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment