passport-slack icon indicating copy to clipboard operation
passport-slack copied to clipboard

Force team auth

Open Apexal opened this issue 7 years ago • 4 comments

Other similar Slack passport libraries allow passing a teamName to the SlackStrategy config to make sure users can only authenticate through a specific team.

Is this possible through this library? I don't see it anywhere in documentation and have tried using teamName and slackTeam in the config but it does not work.

Apexal avatar Feb 09 '18 15:02 Apexal

@Apexal I'm not sure if I understand you correctly. But this package allows you to pass team in options https://github.com/mjpearson/passport-slack/blob/master/lib/passport-slack/strategy.js#L125

passport.use('slack-team', new SlackStrategy(...))
// and then
passport.authenticate('slack-team', {
  team: '<team_id>',
  ...other params
})(req, res, next)

as described here https://api.slack.com/docs/oauth#how_the_team_parameter_behaves

jsarafajr avatar May 14 '18 13:05 jsarafajr

So that parameter seems to attempt to authenticate a user in that workspace, but does not necessarily force it? @jsarafajr

Apexal avatar May 29 '18 05:05 Apexal

@jsarafajr @Apexal Has this been resolved and if so can we post a quick answer in here? I am also having trouble finding documentation about restricting login to a given team/workspace only.

mikemfleming avatar Sep 21 '18 04:09 mikemfleming

@mikemfleming you can use team query parameter. This strategy simply passes that parameter to authorization url. For more information see link to Slack documentation I dropped above.

jsarafajr avatar Sep 21 '18 10:09 jsarafajr