Add support for azure ad b2c auth

pull/7052/head
l.fernandes 2 years ago
parent ece5753ebb
commit f45d822b28

@ -37,12 +37,16 @@ module.exports = {
useCookieInsteadOfSession: keyArray.length > 0, useCookieInsteadOfSession: keyArray.length > 0,
cookieEncryptionKeys: keyArray cookieEncryptionKeys: keyArray
}, async (req, iss, sub, profile, cb) => { }, async (req, iss, sub, profile, cb) => {
const usrEmail = _.get(profile, '_json.email', null) || _.get(profile, '_json.preferred_username') const emails = _.get(profile, '_json.emails', null);
const id = _.get(profile, '_json.sub', null);
const usrEmail = _.get(profile, '_json.email', null) || _.get(profile, '_json.preferred_username') || emails[0]
try { try {
const user = await WIKI.models.users.processProfile({ const user = await WIKI.models.users.processProfile({
providerKey: req.params.strategy, providerKey: req.params.strategy,
profile: { profile: {
id: profile.oid, id: profile.oid || id,
displayName: profile.displayName, displayName: profile.displayName,
email: usrEmail, email: usrEmail,
picture: '' picture: ''

Loading…
Cancel
Save