Sha256: fcd6f739a1c88d63f6600ab8cbf418afb20e4f8dbe66d280201dade3321edbfc

Contents?: true

Size: 723 Bytes

Versions: 1

Compression:

Stored size: 723 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

1 entries across 1 versions & 1 rubygems

Version Path
oauth2_dingtalk-0.1.0 example/config.ru