2011-10-15 23:57:45 -04:00
|
|
|
require 'bundler/setup'
|
|
|
|
require 'sinatra/base'
|
|
|
|
require 'omniauth-facebook'
|
|
|
|
|
|
|
|
class App < Sinatra::Base
|
|
|
|
get '/' do
|
|
|
|
redirect '/auth/facebook'
|
|
|
|
end
|
|
|
|
|
|
|
|
get '/auth/:provider/callback' do
|
|
|
|
content_type 'application/json'
|
|
|
|
MultiJson.encode(request.env)
|
|
|
|
end
|
|
|
|
|
|
|
|
get '/auth/failure' do
|
|
|
|
content_type 'application/json'
|
|
|
|
MultiJson.encode(request.env)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
use Rack::Session::Cookie
|
|
|
|
|
|
|
|
use OmniAuth::Builder do
|
2011-11-19 17:20:23 -05:00
|
|
|
provider :facebook, ENV['APP_ID'], ENV['APP_SECRET'], :scope => 'email,read_stream', :display => 'popup'
|
2011-10-15 23:57:45 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
run App.new
|