require 'sinatra' require "sinatra/reloader" require 'yaml' # configure sinatra set :run, false set :raise_errors, true # REQUEST STEP (server-side flow) get '/server-side' do # NOTE: You would just hit this endpoint directly from the browser in a real app. The redirect is # just here to explicit declare this server-side flow. redirect '/auth/facebook' end # REQUEST STEP (client-side flow) get '/client-side' do content_type 'text/html' # NOTE: When you enable cookie below in the FB.init call the GET request in the FB.login callback # will send a signed request in a cookie back the OmniAuth callback which will parse out the # authorization code and obtain an access_token with it. <<-HTML