Sha256: 17980b89e32df72d110b60719cd51840a4dac0787d6da14350078e89d1fffbb5

Contents?: true

Size: 727 Bytes

Versions: 2

Compression:

Stored size: 727 Bytes

Contents

require 'bundler'
require 'sinatra'
require '../lib/oauth2_dingtalk'

ENV['APPID'] = 'APPID'
ENV['APPSECRET'] = 'APPSECRET'

class App < Sinatra::Base
  get '/' do
    redirect '/auth/dingding'
  end

  get '/auth/:provider/callback' do
    content_type 'application/json'
    puts MultiJson.encode(request.env)
  end

  get '/auth/failure' do
    content_type 'application/json'
    MultiJson.encode(request.env)
  end
end

use Rack::Session::Cookie, secret: 'change_me'

use OmniAuth::Builder do
  # note that the scope is different from the default
  # we also have to repeat the default fields in order to get
  # the extra 'connections' field in there
  provider :dingding, ENV['APPID'], ENV['APPSECRET']
end

run App.new

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
oauth2_dingtalk-0.2.3 example/config.ru
oauth2_dingtalk-0.2.2 example/config.ru