From 059bbe5d416657994b2b63cf03241e567a59eba4 Mon Sep 17 00:00:00 2001 From: olegoid Date: Fri, 11 Sep 2020 14:44:46 -0400 Subject: [PATCH] Add preferred_username to the list of msft token claims --- extensions/microsoft-authentication/src/AADHelper.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extensions/microsoft-authentication/src/AADHelper.ts b/extensions/microsoft-authentication/src/AADHelper.ts index b3461309567f3..6f437ca401a48 100644 --- a/extensions/microsoft-authentication/src/AADHelper.ts +++ b/extensions/microsoft-authentication/src/AADHelper.ts @@ -40,6 +40,7 @@ interface ITokenClaims { tid: string; email?: string; unique_name?: string; + preferred_username?: string; oid?: string; altsecid?: string; ipd?: string; @@ -454,7 +455,7 @@ export class AzureActiveDirectoryService { scope, sessionId: existingId || `${claims.tid}/${(claims.oid || (claims.altsecid || '' + claims.ipd || ''))}/${uuid()}`, account: { - label: claims.email || claims.unique_name || 'user@example.com', + label: claims.email || claims.unique_name || claims.preferred_username || 'user@example.com', id: `${claims.tid}/${(claims.oid || (claims.altsecid || '' + claims.ipd || ''))}` } };