Sha256: 6cdc0727f9c9a4719b5ea8a719623940e1389155555a53658bc435f3f321ce78

Contents?: true

Size: 922 Bytes

Versions: 2

Compression:

Stored size: 922 Bytes

Contents

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
omniauth-createsend-1.0.2 example/config.ru
omniauth-createsend-1.0.1 example/config.ru