wikijs-fork/server/modules/authentication/slack.js

30 lines
733 B
JavaScript
Raw Normal View History

2017-07-29 21:33:08 +00:00
/* global wiki */
// ------------------------------------
// Slack Account
// ------------------------------------
const SlackStrategy = require('passport-slack').Strategy
module.exports = {
key: 'slack',
title: 'Slack',
useForm: false,
props: ['clientId', 'clientSecret'],
init (passport, conf) {
passport.use('slack',
new SlackStrategy({
clientID: conf.clientId,
clientSecret: conf.clientSecret,
callbackURL: conf.callbackURL
}, (accessToken, refreshToken, profile, cb) => {
wiki.db.User.processProfile(profile).then((user) => {
return cb(null, user) || true
}).catch((err) => {
return cb(err, null) || true
})
}
))
}
2017-07-29 21:33:08 +00:00
}