Skip to content

Commit

Permalink
Use user name instead of email if we don't get it
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Clark committed Aug 16, 2023
1 parent 821293c commit f4948b1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/features/auth/auth-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const configureIdentityProvider = () => {
tenantId: process.env.AZURE_AD_TENANT_ID!,
authorization: {
params: {
scope: "openid profile email",
scope: "openid profile user.Read email",
},
},
})
Expand Down
6 changes: 5 additions & 1 deletion src/features/auth/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ export const userSession = async (): Promise<UserModel | null> => {
export const userHashedId = async (): Promise<string> => {
const user = await userSession();
if (user) {
return hashValue(user.email);
if (user.email) {
return hashValue(user.email);
} else {
return hashValue(user.name);
}
}

throw new Error("User not found");
Expand Down

0 comments on commit f4948b1

Please sign in to comment.