require 'sinatra' require "sinatra/reloader" require 'yaml' # configure sinatra set :run, false set :raise_errors, true # setup logging to file log = File.new("app.log", "a+") $stdout.reopen(log) $stderr.reopen(log) $stderr.sync = true $stdout.sync = true # 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 # 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. <<-END