mirror of
https://github.com/requarks/wiki.git
synced 2025-02-25 18:55:30 -06:00
28 lines
772 B
JavaScript
28 lines
772 B
JavaScript
|
'use strict'
|
||
|
|
||
|
/* global wiki */
|
||
|
|
||
|
// ------------------------------------
|
||
|
// Slack Account
|
||
|
// ------------------------------------
|
||
|
|
||
|
const SlackStrategy = require('passport-slack').Strategy
|
||
|
|
||
|
module.exports = (passport) => {
|
||
|
if (wiki.config.auth.slack && wiki.config.auth.slack.enabled) {
|
||
|
passport.use('slack',
|
||
|
new SlackStrategy({
|
||
|
clientID: wiki.config.auth.slack.clientId,
|
||
|
clientSecret: wiki.config.auth.slack.clientSecret,
|
||
|
callbackURL: wiki.config.host + '/login/slack/callback'
|
||
|
}, (accessToken, refreshToken, profile, cb) => {
|
||
|
wiki.db.User.processProfile(profile).then((user) => {
|
||
|
return cb(null, user) || true
|
||
|
}).catch((err) => {
|
||
|
return cb(err, null) || true
|
||
|
})
|
||
|
}
|
||
|
))
|
||
|
}
|
||
|
}
|