Building, integrating, or customizing apps and workflows within Microsoft Teams using developer tools and APIs
Hi silvio aldin
Thank you for reaching out to Microsoft Q&A forum
Based on my research, in Teams Tab SSO, microsoftTeams.authentication.getAuthToken() can return different token types depending on the client. On Desktop/Web, the token is typically meant to be exchanged by your backend (OBO) for a Microsoft Graph token. On Teams Mobile, the token can already be a Graph-audience token, so attempting the same OBO exchange can fail with 400 Bad Request / invalid_grant even though sub and tid look correct.
Given this, below suggested approach might help:
- In your backend, decode the incoming JWT and check the
audclaim before doing OBO. Ifaudishttps://graph.microsoft.com, validate and use it directly for Graph calls; ifaudis your API’s Application ID URI (api://...), proceed with the standard OBO exchange. - Verify your Entra ID tab SSO configuration is aligned with Microsoft guidance (app registration + exposed API + trusted/preauthorized client setup for Teams clients), since misconfiguration can also surface as auth/token errors across clients.
Link references:
https://learn.microsoft.com/en-us/answers/questions/5764199/token-exchange-fails-specifically-on-mobile-client
Hope my answer will help you.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.