{"id":21031285,"url":"https://github.com/workable/passport-slack-v2","last_synced_at":"2026-04-25T15:35:43.611Z","repository":{"id":65154110,"uuid":"579044870","full_name":"Workable/passport-slack-v2","owner":"Workable","description":null,"archived":false,"fork":false,"pushed_at":"2024-05-02T05:32:34.000Z","size":100,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-02-21T12:05:14.375Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Workable.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-16T14:18:27.000Z","updated_at":"2022-12-22T14:06:57.000Z","dependencies_parsed_at":"2024-05-02T06:42:06.340Z","dependency_job_id":"3e4ada41-8399-4ddc-9db4-26cb63f70f15","html_url":"https://github.com/Workable/passport-slack-v2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Workable%2Fpassport-slack-v2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Workable%2Fpassport-slack-v2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Workable%2Fpassport-slack-v2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Workable%2Fpassport-slack-v2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Workable","download_url":"https://codeload.github.com/Workable/passport-slack-v2/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243471432,"owners_count":20296114,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T12:27:04.892Z","updated_at":"2025-12-28T15:57:49.246Z","avatar_url":"https://github.com/Workable.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# passport-slack-v2\n\n[Passport](https://github.com/Workable/passport-slack-v2) strategy for authenticating\nwith [Slack](https://slack.com) using the [V2](https://api.slack.com/authentication/oauth-v2) OAuth 2.0 API.\n\nUpdated to support Sign in with Slack by default.\n\n[![Sign in with Slack](https://a.slack-edge.com/accd8/img/sign_in_with_slack.png)](https://api.slack.com/docs/sign-in-with-slack#identify_users_and_their_teams)\n\n## Install\n\n```shell\n$ npm install @workablehr/passport-slack-v2\n```\n\n\n## Express Example\n```js\nconst {CLIENT_ID, CLIENT_SECRET, PORT} = process.env,\n      SlackStrategy = require('passport-slack-v2').Strategy,\n      passport = require('passport'),\n      express = require('express'),\n      app = express();\n\n// setup the strategy using defaults \npassport.use(new SlackStrategy({\n    clientID: CLIENT_ID,\n    clientSecret: CLIENT_SECRET\n  }, (accessToken, refreshToken, profile, done) =\u003e {\n    // optionally persist profile data\n    done(null, profile);\n  }\n));\n\nconst app = express();\napp.use(passport.initialize());\napp.use(express.urlencoded({ extended: true }));\n\n// path to start the OAuth flow\napp.get('/auth/slack', passport.authorize('slack'));\n\n// OAuth callback url\napp.get('/auth/slack/callback', \n  passport.authorize('slack', { failureRedirect: '/login' }),\n  (req, res) =\u003e res.redirect('/')\n);\n\napp.listen(PORT);\n```\n\n## Sample Profile\n```json\n{\n  \"ok\": true,\n  \"user\": {\n    \"id\": \"W012A3CDE\",\n    \"team_id\": \"T012AB3C4\",\n    \"name\": \"spengler\",\n    \"deleted\": false,\n    \"color\": \"9f69e7\",\n    \"real_name\": \"Egon Spengler\",\n    \"tz\": \"America/Los_Angeles\",\n    \"tz_label\": \"Pacific Daylight Time\",\n    \"tz_offset\": -25200,\n    \"profile\": {\n      \"avatar_hash\": \"ge3b51ca72de\",\n      \"status_text\": \"Print is dead\",\n      \"status_emoji\": \":books:\",\n      \"real_name\": \"Egon Spengler\",\n      \"display_name\": \"spengler\",\n      \"real_name_normalized\": \"Egon Spengler\",\n      \"display_name_normalized\": \"spengler\",\n      \"email\": \"spengler@ghostbusters.example.com\",\n      \"image_original\": \"https://.../avatar/e3b51ca72dee4ef87916ae2b9240df50.jpg\",\n      \"image_24\": \"https://.../avatar/e3b51ca72dee4ef87916ae2b9240df50.jpg\",\n      \"image_32\": \"https://.../avatar/e3b51ca72dee4ef87916ae2b9240df50.jpg\",\n      \"image_48\": \"https://.../avatar/e3b51ca72dee4ef87916ae2b9240df50.jpg\",\n      \"image_72\": \"https://.../avatar/e3b51ca72dee4ef87916ae2b9240df50.jpg\",\n      \"image_192\": \"https://.../avatar/e3b51ca72dee4ef87916ae2b9240df50.jpg\",\n      \"image_512\": \"https://.../avatar/e3b51ca72dee4ef87916ae2b9240df50.jpg\",\n      \"team\": \"T012AB3C4\"\n    },\n    \"is_admin\": true,\n    \"is_owner\": false,\n    \"is_primary_owner\": false,\n    \"is_restricted\": false,\n    \"is_ultra_restricted\": false,\n    \"is_bot\": false,\n    \"updated\": 1502138686,\n    \"is_app_user\": false,\n    \"has_2fa\": false\n  }\n}\n```\n\n## Usage\n\n### Configure the Strategy\n\nThe Slack authentication strategy authenticates users using a Slack\naccount and OAuth 2.0 tokens.  The strategy requires a `verify` callback, which\naccepts these credentials and calls `done` providing a user, as well as\n`options` specifying a client ID, client secret, and callback URL.\n\n```js\npassport.use(new SlackStrategy({\n    clientID: CLIENT_ID,\n    clientSecret: CLIENT_SECRET,\n    skipUserProfile: false, // default\n    scope: [],\n    user_scope: [],\n    passReqToCallback: true\n  },\n  (accessToken, refreshToken, profile, done) =\u003e {\n    // optionally persist user data into a database\n    done(null, profile);\n  }\n));\n```\n\n### Authentication Requests\n\nUse `passport.authenticate()` (or `passport.authorize()` if you want to authenticate with Slack and **NOT** affect `req.user` and the user session), specifying the `'slack'` strategy, to\nauthenticate requests.\n\nFor example, as route middleware in an [Express](http://expressjs.com/)\napplication:\n\n```js\napp.get('/auth/slack', passport.authorize('Slack'));\n\napp.get('/auth/slack/callback',\n  passport.authenticate('slack', { failureRedirect: '/login' }),\n  (req, res) =\u003e res.redirect('/') // Successful authentication, redirect home.\n);\n```\n\n### Custom Scopes\n#### User Scopes\nBy default, the passport-slack-v2 strategy attempts to retrieve [the user's identity](https://api.slack.com/methods/users.info) from Slack. This action requires at least the following scopes `users:read` and `users:read.email`.\n\n```js\npassport.use(new SlackStrategy({\n\tclientID: CLIENT_ID,\n\tclientSecret: CLIENT_SECRET,\n\tuser_scope: ['users:read', 'users:read.email']\n}, () =\u003e { }));\n```\n\n#### Bot Scopes\nFor bot scopes, set the `scope` parameter to an array of the desired scopes.\n```js\npassport.use(new SlackStrategy({\n\tclientID: CLIENT_ID,\n\tclientSecret: CLIENT_SECRET,\n\tscope: ['channels:manage', 'groups:write', 'im:write', 'mpim:write']\n}, () =\u003e { }));\n```\n\n### Ignore Profile Info\nIf you only need an access token and no user profile data, you can avoid getting profile information by setting `skipUserProfile` to true.\n```js\npassport.use(new SlackStrategy({\n\tclientID: CLIENT_ID,\n\tclientSecret: CLIENT_SECRET,\n\tscope: ['incoming-webhook'],\n\tskipUserProfile: true\n}, () =\u003e { });\n```\n\n## Thanks\n- [Jared Hanson](http://github.com/jaredhanson)\n- [Michael Pearson](https://github.com/mjpearson)\n\n## License\n\n[The MIT License](http://opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworkable%2Fpassport-slack-v2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fworkable%2Fpassport-slack-v2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworkable%2Fpassport-slack-v2/lists"}