require 'sinatra' require 'omniauth-twitter' require 'omniauth-salesforce' configure do enable :sessions end helpers do def h(text) Rack::Utils.escape_html(text) end end use OmniAuth::Builder do provider :twitter, ENV['TWITTER_CONSUMER_KEY'], ENV['TWITTER_CONSUMER_SECRET'] provider :salesforce, ENV['SALESFORCE_CONSUMER_KEY'], ENV['SALESFORCE_CONSUMER_SECRET'] end OmniAuth.config.full_host = "https://auth.vulpine.com" get '/test' do erb("<%= h 'Succful.'%>") end get '/login/twitter' do redirect to('/auth/twitter') end get '/login' do redirect to('/auth/salesforce') end get '/auth/:provider/callback' do puts env['omniauth.auth'].inspect session[:user] = env['omniauth.auth']['raw_info'] session[:uid] = env['omniauth.auth']['uid'] session[:logged_in] = true erb <<-EOHTML Welcome!

Hello <%= h env['omniauth.auth']['info']['name'] %>!


<%= h env['omniauth.auth'].inspect %>

From provider: #{env['omniauth.auth']['provider']} vs. #{params[:provider]} EOHTML end get '/auth/failure' do params[:message] end