Sha256: 53e9f386479c6f0f0f4b06aad86863332049e9633d311c3b6a3ae2db81a15de0

Contents?: true

Size: 720 Bytes

Versions: 3

Compression:

Stored size: 720 Bytes

Contents

require 'bundler'
require 'sinatra'
require '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

3 entries across 3 versions & 1 rubygems

Version Path
oauth2_dingtalk-0.2.4 example/config.ru
oauth2_dingtalk-0.2.0 example/config.ru
oauth2_dingtalk-0.1.1 example/config.ru