Skip to content

Commit 352a390

Browse files
authored
Add preferred_username to the list of msft token claims (#106511)
1 parent c53524a commit 352a390

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

extensions/microsoft-authentication/src/AADHelper.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ interface ITokenClaims {
4040
tid: string;
4141
email?: string;
4242
unique_name?: string;
43+
preferred_username?: string;
4344
oid?: string;
4445
altsecid?: string;
4546
ipd?: string;
@@ -454,7 +455,7 @@ export class AzureActiveDirectoryService {
454455
scope,
455456
sessionId: existingId || `${claims.tid}/${(claims.oid || (claims.altsecid || '' + claims.ipd || ''))}/${uuid()}`,
456457
account: {
457-
label: claims.email || claims.unique_name || '[email protected]',
458+
label: claims.email || claims.unique_name || claims.preferred_username || '[email protected]',
458459
id: `${claims.tid}/${(claims.oid || (claims.altsecid || '' + claims.ipd || ''))}`
459460
}
460461
};

0 commit comments

Comments
 (0)