Sha256: 6788c7aacfd638d1abb6e49ec15ac137831d75e9539e88883f27082d412eaf76

Contents?: true

Size: 1.36 KB

Versions: 1

Compression:

Stored size: 1.36 KB

Contents

# SlackOauth

oauth client library for sinatra

# Coverage
- Whether authorized with allowed team
- authorized user's token(slack)
- team id(slack) using the authorization
- team name(slack) using the authorization

# Caution
don't use Rack::Session::Cookie

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'slack_oauth'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install slack_oauth

## Usage

```ruby
require 'sinatra/base'
require 'slack_oauth'

register SlackOauth::Driver

configure do
  set :slack_token, 'xxxxx-xxxxx-xxxx-xxxx' # required
  set :slack_client_id, 'nnnnnn.nnnnn' # required
  set :slack_secret_key, 'xxxxxxxxxxxxxxxxxx' # required
  set :logined_uri, '/' # required if use register
  set :error_uri, '/' # required if use register
  set :slack_redirect_uri, 'http://yourhost:4567/oauth'
  set :slack_team, 'your-team' # or nil
  set :slack_allowed_teams, ['allowed team'] # required
  set :slack_scope, 'identify' # required
  use Rack::Session::Pool, # slack_oauth use session
      :expire_after => 3600
end

get '/' do
 <<-EOS
<html>
<body>
#{(authorized?) ? 'Authorized<br>' : ''}
<a href="#{get_authentication_url}">sign in</a>
</body>
</html>
EOS
end

get '/signout' do
  session.clear
end

```


## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/m0cchi/slack_oauth.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
slack_oauth-0.3.0 README.md