-
Notifications
You must be signed in to change notification settings - Fork 5
/
config.ru
31 lines (25 loc) · 922 Bytes
/
config.ru
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
require "bundler/setup"
require "sinatra/base"
require "omniauth-createsend"
class App < Sinatra::Base
get "/" do
redirect "/auth/createsend"
end
get "/auth/createsend/callback" do
response = "Your user is successfully authenticated. Here are the details you need:<br/><br/>"
response << "access token: #{request.env['omniauth.auth']['credentials']['token']}<br/>"
response << "refresh token: #{request.env['omniauth.auth']['credentials']['refresh_token']}<br/>"
response << "expires at: #{request.env['omniauth.auth']['credentials']['expires_at']}<br/>"
response
end
get "/auth/failure" do
content_type "application/json"
MultiJson.encode(request.env)
end
end
use Rack::Session::Cookie
use OmniAuth::Builder do
provider :createsend, ENV["CREATESEND_CLIENT_ID"], ENV["CREATESEND_CLIENT_SECRET"],
:scope => "ViewReports,CreateCampaigns,SendCampaigns"
end
run App.new