Skip to content

Commit

Permalink
fix(outlook-api): If mail property is not provided in user profile, t…
Browse files Browse the repository at this point in the history
…hen use userPrincipalName instead
  • Loading branch information
andris9 committed Oct 31, 2024
1 parent cb1501e commit 2e2224c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions workers/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -1958,6 +1958,13 @@ const init = async () => {
throw err;
}

request.logger.info({
msg: 'User profile returned by MS Graph API',
user: userInfo.email,
provider: oauth2App.provider,
profile: profileRes
});

if (profileRes.displayName) {
userInfo.name = profileRes.displayName;
}
Expand All @@ -1969,6 +1976,10 @@ const init = async () => {
if (profileRes.userPrincipalName) {
userInfo.username = profileRes.userPrincipalName;
}

if (!userInfo.email && userInfo.username) {
userInfo.email = userInfo.username;
}
}

const authData = {
Expand Down

0 comments on commit 2e2224c

Please sign in to comment.