2018-03-05 15:49:36 -05:00
|
|
|
/* global WIKI */
|
2017-07-29 17:33:08 -04:00
|
|
|
|
|
|
|
// ------------------------------------
|
|
|
|
// Google ID Account
|
|
|
|
// ------------------------------------
|
|
|
|
|
|
|
|
const GoogleStrategy = require('passport-google-oauth20').Strategy
|
|
|
|
|
2017-09-10 23:00:03 -04:00
|
|
|
module.exports = {
|
|
|
|
init (passport, conf) {
|
|
|
|
passport.use('google',
|
|
|
|
new GoogleStrategy({
|
|
|
|
clientID: conf.clientId,
|
|
|
|
clientSecret: conf.clientSecret,
|
|
|
|
callbackURL: conf.callbackURL
|
|
|
|
}, (accessToken, refreshToken, profile, cb) => {
|
2018-07-29 22:23:33 -04:00
|
|
|
WIKI.models.users.processProfile(profile).then((user) => {
|
2017-09-10 23:00:03 -04:00
|
|
|
return cb(null, user) || true
|
|
|
|
}).catch((err) => {
|
|
|
|
return cb(err, null) || true
|
|
|
|
})
|
2017-12-30 02:00:49 -05:00
|
|
|
})
|
|
|
|
)
|
2017-09-10 23:00:03 -04:00
|
|
|
}
|
2017-07-29 17:33:08 -04:00
|
|
|
}
|