feat: auth0 + discord + github + slack auth modules
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
))
|
||||
}
|
||||
|
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user