2018-03-05 20:49:36 +00:00
|
|
|
/* global WIKI */
|
2017-07-29 21:33:08 +00:00
|
|
|
|
|
|
|
// ------------------------------------
|
|
|
|
// Facebook Account
|
|
|
|
// ------------------------------------
|
|
|
|
|
|
|
|
const FacebookStrategy = require('passport-facebook').Strategy
|
|
|
|
|
2017-09-11 03:00:03 +00:00
|
|
|
module.exports = {
|
|
|
|
init (passport, conf) {
|
|
|
|
passport.use('facebook',
|
|
|
|
new FacebookStrategy({
|
|
|
|
clientID: conf.clientId,
|
|
|
|
clientSecret: conf.clientSecret,
|
|
|
|
callbackURL: conf.callbackURL,
|
|
|
|
profileFields: ['id', 'displayName', 'email']
|
|
|
|
}, function (accessToken, refreshToken, profile, cb) {
|
2018-07-30 02:23:33 +00:00
|
|
|
WIKI.models.users.processProfile(profile).then((user) => {
|
2017-09-11 03:00:03 +00:00
|
|
|
return cb(null, user) || true
|
|
|
|
}).catch((err) => {
|
|
|
|
return cb(err, null) || true
|
|
|
|
})
|
|
|
|
}
|
|
|
|
))
|
|
|
|
}
|
2017-07-29 21:33:08 +00:00
|
|
|
}
|