The project is in a healthy, maintained state
An OmniAuth strategy for implementing Sign-in with Slack using OpenID Connect
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

Runtime

>= 0
~> 2.0, >= 2.0.25
~> 2.0
 Project Readme

omniauth-slack-openid.rb

Gem Version Test Status codecov

An OmniAuth strategy for implementing Sign-in with Slack using OpenID Connect.

Official Slack API documentation: https://api.slack.com/authentication/sign-in-with-slack

Identity model

This strategy exchanges the OAuth authorization code for an access token, then loads identity from Slack openid.connect.userInfo. Slack's id_token JWT is left unchecked (signature, aud, iss, exp, and nonce). Treat the OmniAuth AuthHash as session identity from Slack's token and userInfo endpoints. It is not a fully verified OIDC ID token.

info[:email] is set when Slack reports email_verified: true. Unverified addresses stay on extra[:data].email and extra[:raw_info] for display or support flows.

Install

Using Bundler:

bundle add omniauth-slack-openid

Using RubyGems:

gem install omniauth-slack-openid

Gemfile

gem 'omniauth-slack-openid'

Usage with Devise

Create Slack app and configure OAuth & Permissions to have the following Redirect URLs:

Copy Client ID and Client Secret to your environment (e.g. .env.local file):

SLACK_CLIENT_ID=1234567890.1234567890
SLACK_CLIENT_SECRET=1234567890abcdef1234567890abcdef

Add the following to your config/initializers/devise.rb:

  config.omniauth(
    :slack_openid,
    ENV.fetch("SLACK_CLIENT_ID"),
    ENV.fetch("SLACK_CLIENT_SECRET"),
    {
      scope: "openid,email,profile",
      redirect_uri: Rails.env.development? ? "https://localhost:3000/user/auth/slack_openid/callback" : nil
    }
  )

Leave OmniAuth CSRF state checks on (provider_ignores_state unset or false). Fix local TLS or redirect_uri when callbacks fail in development. For local testing against an HTTPS redirect registered in Slack, finish the authorize step, then adjust the callback host or scheme only as needed while state verification stays enabled.

Generating uid

The gem provides generate_uid, which joins team_id and user_id. Call it with your own parameters when you need the same compound id:

def resolve_user_session(team_id, user_id)
  uid = OmniAuth::Strategies::SlackOpenid.generate_uid(team_id, user_id)
  UserSession.find_by(uid: uid, provider: "slack-openid")
end

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/amkisko/omniauth-slack-openid.rb

Publishing

Maintainers cut a release from a clean worktree with:

make release

That path runs lint, tests, changelog and confirmation gates, then gem push, tags, and a GitHub release.

Links

License

The gem is available as open source under the terms of the MIT License.

Sponsors

Sponsored by Kisko Labs.

Sponsored by Kisko Labs