require 'bundler/setup'
require 'sinatra/base'
require 'omniauth-mailup'
class App < Sinatra::Base
get '/' do
<<-HTML
Your credentials are :
- client id : #{ENV["MAILUP_CLIENT_ID"]}
- secret key : #{ENV["MAILUP_CLIENT_SECRET"]}
Sign in with MailUp
HTML
end
get '/auth/:provider/callback' do
content_type 'text/plain'
token = request.env['omniauth.auth']['credentials']['token']
"Access token is #{token}".inspect rescue "No data"
end
get '/auth/failure' do
content_type 'text/plain'
request.env['omniauth.auth'].to_hash.inspect rescue "No Data"
end
end
use Rack::Session::Cookie, :secret => ENV['RACK_COOKIE_SECRET']
use OmniAuth::Builder do
provider :mailup, ENV["MAILUP_CLIENT_ID"], ENV["MAILUP_CLIENT_SECRET"]
end
run App.new