Skip to content

Instantly share code, notes, and snippets.

@rmanalan
Created December 4, 2010 05:57
Show Gist options
  • Save rmanalan/727958 to your computer and use it in GitHub Desktop.
Save rmanalan/727958 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'bundler/setup'
require 'sinatra'
require 'omniauth'
require 'openid/store/filesystem'
use Rack::Session::Cookie
use OmniAuth::Builder do
provider :open_id, OpenID::Store::Filesystem.new('/tmp')
provider :twitter, 'xxx', 'xxx'
end
enable :static
get '/' do
if @auth
"Welcome #{@auth.inspect} "
else
"Logged out. <a href='/auth/twitter'>login</a>"
end
end
get '/auth/:provider/callback' do
@auth = request.env['omniauth.auth']
@auth.inspect
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment