mirror of https://github.com/requarks/wiki
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
780 B
30 lines
780 B
/* global WIKI */
|
|
|
|
// ------------------------------------
|
|
// Okta Account
|
|
// ------------------------------------
|
|
|
|
const OktaStrategy = require('passport-okta-oauth').Strategy
|
|
|
|
module.exports = {
|
|
init (passport, conf) {
|
|
passport.use('okta',
|
|
new OktaStrategy({
|
|
audience: conf.audience,
|
|
clientID: conf.clientId,
|
|
clientSecret: conf.clientSecret,
|
|
idp: conf.idp,
|
|
callbackURL: conf.callbackURL,
|
|
response_type: 'code',
|
|
scope: ['openid', 'email', 'profile']
|
|
}, (accessToken, refreshToken, profile, cb) => {
|
|
WIKI.models.users.processProfile(profile).then((user) => {
|
|
return cb(null, user) || true
|
|
}).catch((err) => {
|
|
return cb(err, null) || true
|
|
})
|
|
})
|
|
)
|
|
}
|
|
}
|