Teams User Access Token; access user info?

Jeroen H 40 Reputation points
2024-02-21T15:25:06.7066667+00:00

Hi everyone, I'm currently developing an app in Teams that uses the Communication Services calling SDK to fire an event when the user is called. For this purpose, the user logs in and an Entra ID token and Teams user access token are generated. I would also like to authenticate the user to our own database (as it is a CTI application). If I could get the user's email address with either token then that would be sufficient for this task. Is there a way to get that info with these tokens? I already tried getting the profile info from MS Graph using the Entra token, but creates a 'InvalidAuthenticationToken' error, stating 'KeyWrapFailed' as a message. Weirdly enough, using the same authentication code to create the Entra ID token to create a token from MS Graph in Postman works just fine, and this token actually is able to get the user profile in Graph, but doesn't work for generating the Teams user access token.

Tldl: how do I get a Teams user's email with the use of their Entra ID and Teams user access token? The Entra ID Token gives errors when attempted to use in MS Graph.

Microsoft Teams
Microsoft Teams
A Microsoft customizable chat-based workspace.
9,131 questions
Azure Communication Services
Azure Communication Services
An Azure communication platform for deploying applications across devices and platforms.
686 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,669 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
2,877 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,584 questions
0 comments No comments
{count} votes

Accepted answer
  1. ChetanSharmamsft 1,026 Reputation points Microsoft Vendor
    2024-02-22T06:47:21.7566667+00:00

    Hello @Jeroen H - Thanks for raising your query.
    You can simply decode the generated user token and can get the user information like user UPN/email/Entra ID etc.

    User's image

    Please let us know if you still have any query.

    0 comments No comments

0 additional answers

Sort by: Most helpful