Sha256: 4dd94cc908780f3d169088ab239de903d9cad720b34546305500b05869e42b20

Contents?: true

Size: 708 Bytes

Versions: 1

Compression:

Stored size: 708 Bytes

Contents

require_relative 'version.rb'
require_relative 'helper.rb'
require 'sinatra/base'
require 'net/https'
require 'json'

module SlackOauth
  module Driver

    def self.registered(app)
      app.helpers SlackOauth::Driver::Helper

      app.get '/oauth' do
        if authorized?
          redirect app.settings.logined_uri
        elsif !params[:error].nil?
          redirect settings.error_uri
        elsif !params[:code].nil?
          if validate_state(params[:state]) && authorize(params[:code])
            redirect settings.logined_uri
          else
            redirect settings.error_uri
          end
        else
          redirect get_authentication_url
        end
      end

    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
slack_oauth-0.3.0 lib/slack_oauth.rb