passport-slack
passport-slack copied to clipboard
Doesn't Return Bot access Token
As per the slack API documentation (https://api.slack.com/docs/oauth see section "Bot user access tokens"), when a bot created, the JSON payload should return the access token along with the bot user access token. However, we only get the accessToken. Is there a way to get both tokens by adding a parameter to the Oauth flow?
Any update on this?
Nope, I gave trying to make it work. I decided to use the Slack button to start the OAuth flow and get the tokens with a simple get request
I would love this as well! I'm confused about how bot tokens fit into the oauth flow.
Include bot in the scope option, and also add a params argument to the verify callback:
passport.use(new SlackStrategy({
clientID: process.env.SLACK_CLIENT_ID,
clientSecret: process.env.SLACK_CLIENT_SECRET,
scope: 'bot users:read',
}, (accessToken, refreshToken, params, profile, done) => {
console.log(params.bot); // Should have `bot_user_id` and `bot_access_token`
}));
It's probably documented elsewhere --- took me forever to figure that out, sadly.