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.displa...
Sayali-MSFT
Microsoft
Jul 04, 2023vovanb -This is by design behavior. Teams has never returned the displayName in the app context.
- vovanbJul 04, 2023Copper ContributorSo how I can obtain user display name from Teams Tab application?
- Sayali-MSFTJul 04, 2023
Microsoft
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- vovanbJul 04, 2023Copper ContributorTo be honest I am not happy with your answer - the documentation https://learn.microsoft.com/en-us/microsoftteams/platform/tabs/how-to/access-teams-context?tabs=Json-v2%2Cteamsjs-v2
show that "user": has "displayName" but it does not says that it will be always empty.
Why if it is not available you return it?