feat: oauth2 login (wip)

This commit is contained in:
Nick
2019-04-21 02:04:00 -04:00
parent 6fe49309c1
commit 8af21c02af
7 changed files with 67 additions and 26 deletions

View File

@@ -14,12 +14,14 @@ module.exports = {
clientID: conf.clientId,
clientSecret: conf.clientSecret,
callbackURL: conf.callbackURL
}, function (accessToken, refreshToken, profile, cb) {
WIKI.models.users.processProfile(profile).then((user) => {
return cb(null, user) || true
}).catch((err) => {
return cb(err, null) || true
})
}, async (accessToken, refreshToken, extraParams, profile, cb) => {
console.info(accessToken, refreshToken, extraParams, profile)
try {
const user = WIKI.models.users.processProfile({ profile, provider: 'auth0' })
cb(null, user)
} catch (err) {
cb(err, null)
}
}
))
}