Forum Discussion
vovanb
Jul 03, 2023Copper Contributor
in Microsoft Teams JavaScript library user.displayname is always empty
Hello,
Using TeamsJS library v2 :
microsoftTeams.initialize(); microsoftTeams.getContext((context) => { console.log("microsoftTeams context", context); });
But context.user.displayName is always empty. What is wrong?
- Bingo_YangCopper ContributorWhatever it is the feature or bug, I hope we can get user. display name from Deleted/teams-js; otherwise, it is hard to separate who is.
- Sayali-MSFTMicrosoft
vovanb -This is by design behavior. Teams has never returned the displayName in the app context.
- vovanbCopper ContributorSo how I can obtain user display name from Teams Tab application?
- Sayali-MSFTMicrosoft
vovanb - You can authenticate the user and get their name from the auth token:
https://learn.microsoft.com/en-us/microsoftteams/platform/tabs/how-to/authentication/tab-sso-overview