This gem contains Slack SignIn strategy for OmniAuth. It works with minimum required identity.basic
scope. And calls /api/users.identity
to fetch team_id
, user_id
, user_name
.
Add this gem to your Gemfile:
gem 'omniauth-slacksignin', github: 'ignat/omniauth-slacksignin'
Add the following code to your Devise initializer:
config.omniauth :slacksignin, ENV['SLACK_APP_ID'], ENV['SLACK_APP_SECRET'], scope: 'identity.basic'
Add callback routes to your config/routes.rb:
devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }
and then add slacksignin method to omniauth_callbacks_controller.rb:
def slacksignin
omniauth = request.env["omniauth.auth"]
# Use team_id, user_id, user_name to identify logged in user
end
The login page will be available at the following path: /users/auth/slacksignin
You can pass OmniAuth options during initialization:
config.omniauth :slacksignin, ENV['SLACK_APP_ID'], ENV['SLACK_APP_SECRET'], scope: 'identity.basic', name: 'slack'
This will change the provider name to 'slack'.
- Fork it
- Create your feature branch
git checkout -b my-new-feature
- Commit your changes
git commit -m 'Add some feature'
- Push to the branch
git push origin my-new-feature
- Create new Pull Request