Sha256: bf90ead5b1db584d97214d48b573a3a77e31289709ffbe8525d159863b74e91a

Contents?: true

Size: 896 Bytes

Versions: 1

Compression:

Stored size: 896 Bytes

Contents

# Make sure to setup the ENV variables DASH_ID and DASH_SECRET
# Run with `bundle exec rackup`

require 'rubygems'
require 'bundler'
require 'sinatra'
require 'omniauth-dash'

class DashApp < Sinatra::Base

  get '/' do
    <<-HTML
      <p><a href="/auth/dash">Sign into Dash</a></p>
    HTML
  end

  get '/auth/:provider/callback' do |provider|
    content_type 'text/plain'
    %{ #{provider} token: #{request.env['omniauth.auth'].to_hash['credentials'].inspect}
     } rescue 'No data returned'
  end

  get '/auth/failure' do
    content_type 'text/plain'
    %{ Error: #{request.env['omniauth.auth'].to_hash.inspect}
     } rescue 'No data returned'
  end
end

use Rack::Session::Cookie, :secret => 'abc'

use OmniAuth::Builder do
  provider :dash, ENV['DASH_ID'], ENV['DASH_SECRET'], :scope => 'user trips', :callback_url => 'http://127.0.0.1:9292/auth/dash/callback'
end

run DashApp.new

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
omniauth-dash-0.1.0 examples/config.ru