I'm developing an app that has slack signin functionality.
I'm using passport-slack for OAuth but having some problem about routing which return Cannot GET /auth/slack
I followed the step by step procedure which can be found in https://github.com/mjpearson/passport-slack but still no luck
My current code for passport is like this which I think I define the routes correctly
// setup the strategy using defaults
passport.use(new SlackStrategy({
clientID: environment.SLACK.CLIENT_ID,
clientSecret: environment.SLACK.CLIENT_SECRET,
}, (accessToken, refreshToken, profile, done) => {
done(null, profile);
}));
// path to start the OAuth flow
app.get('/auth/slack', passport.authenticate('slack'));
// OAuth callback url
app.get('/auth/slack/callback',
passport.authenticate('slack', { successRedirect: '/',
failureRedirect: '/login' }));
/auth/slack
is just a middleware for authentication, which means all the routes begin with /auth/slack
will invoke this middleware.
Also because you don have any response
for this route, and passport will just invoke the next()
function, so Cannot GET /auth/slack
You should put /auth/slack/callback
in your slack settings, slack will redirect the user to this route after the user sign in on slack