feat: auth0 + discord + github + slack auth modules

This commit is contained in:
Nick
2019-04-21 21:43:33 -04:00
parent 8af21c02af
commit d7676513ac
20 changed files with 286 additions and 99 deletions

View File

@@ -5,6 +5,7 @@
// ------------------------------------
const GitHubStrategy = require('passport-github2').Strategy
const _ = require('lodash')
module.exports = {
init (passport, conf) {
@@ -14,12 +15,19 @@ module.exports = {
clientSecret: conf.clientSecret,
callbackURL: conf.callbackURL,
scope: ['user:email']
}, (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, profile, cb) => {
try {
const user = await WIKI.models.users.processProfile({
profile: {
...profile,
picture: _.get(profile, 'photos[0].value', '')
},
providerKey: 'github'
})
cb(null, user)
} catch (err) {
cb(err, null)
}
}
))
}

View File

@@ -5,7 +5,17 @@ author: requarks.io
logo: https://static.requarks.io/logo/github.svg
color: grey darken-3
website: https://github.com
isAvailable: true
useForm: false
props:
clientId: String
clientSecret: String
clientId:
type: String
title: Client ID
hint: Application Client ID
order: 1
clientSecret:
type: String
title: Client Secret
hint: Application Client Secret
order: 2