feat: auth0 + discord + github + slack auth modules
This commit is contained in:
@@ -4,7 +4,8 @@
|
||||
// Slack Account
|
||||
// ------------------------------------
|
||||
|
||||
const SlackStrategy = require('passport-slack').Strategy
|
||||
const SlackStrategy = require('@aoberoi/passport-slack').default.Strategy
|
||||
const _ = require('lodash')
|
||||
|
||||
module.exports = {
|
||||
init (passport, conf) {
|
||||
@@ -12,13 +13,21 @@ module.exports = {
|
||||
new SlackStrategy({
|
||||
clientID: conf.clientId,
|
||||
clientSecret: conf.clientSecret,
|
||||
callbackURL: conf.callbackURL
|
||||
}, (accessToken, refreshToken, profile, cb) => {
|
||||
WIKI.models.users.processProfile(profile).then((user) => {
|
||||
return cb(null, user) || true
|
||||
}).catch((err) => {
|
||||
return cb(err, null) || true
|
||||
})
|
||||
callbackURL: conf.callbackURL,
|
||||
team: conf.team
|
||||
}, async (accessToken, scopes, team, extra, { user: userProfile }, cb) => {
|
||||
try {
|
||||
const user = await WIKI.models.users.processProfile({
|
||||
profile: {
|
||||
...userProfile,
|
||||
picture: _.get(userProfile, 'image_48', '')
|
||||
},
|
||||
providerKey: 'slack'
|
||||
})
|
||||
cb(null, user)
|
||||
} catch (err) {
|
||||
cb(err, null)
|
||||
}
|
||||
}
|
||||
))
|
||||
}
|
||||
|
@@ -5,7 +5,25 @@ author: requarks.io
|
||||
logo: https://static.requarks.io/logo/slack.svg
|
||||
color: green
|
||||
website: https://api.slack.com/docs/oauth
|
||||
isAvailable: true
|
||||
useForm: false
|
||||
scope:
|
||||
- identity.basic
|
||||
- identity.email
|
||||
- identity.avatar
|
||||
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
|
||||
team:
|
||||
type: String
|
||||
title: Team / Workspace ID
|
||||
hint: Optional - Your unique team (workspace) identifier
|
||||
order: 3
|
||||
|
Reference in New Issue
Block a user