Skip to content

Instantly share code, notes, and snippets.

@mbleigh
Created September 28, 2011 16:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbleigh/1248352 to your computer and use it in GitHub Desktop.
Save mbleigh/1248352 to your computer and use it in GitHub Desktop.
How to use OmniAuth 1.0 RIGHT. NOW.
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
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