From 692e5ca0bd65ff6be2a064516840f61a370f03b3 Mon Sep 17 00:00:00 2001 From: NGPixel Date: Sun, 27 Oct 2019 13:57:39 -0400 Subject: [PATCH] fix: use preferred_username as alternate for Azure AD --- server/modules/authentication/azure/authentication.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/modules/authentication/azure/authentication.js b/server/modules/authentication/azure/authentication.js index 60898779..c28e80e9 100644 --- a/server/modules/authentication/azure/authentication.js +++ b/server/modules/authentication/azure/authentication.js @@ -20,12 +20,13 @@ module.exports = { scope: ['profile', 'email', 'openid'], allowHttpForRedirectUrl: WIKI.IS_DEBUG }, async (iss, sub, profile, cb) => { + const usrEmail = _.get(profile, '_json.email', null) || _.get(profile, '_json.preferred_username') try { const user = await WIKI.models.users.processProfile({ profile: { id: profile.oid, displayName: profile.displayName, - email: _.get(profile, '_json.email', ''), + email: usrEmail, picture: '' }, providerKey: 'azure'