Forum Discussion
SPFx webparts not able to acquire token for Graph API in Teams app (Viva Connections)
Hi all,
There is a very strange thing happening to a few webparts that we've build for one of our clients. We haven't seen this problem in other tenants, it seems to be related to this specific tenant. Maybe it's a setting, or maybe it's a bug. Hopefully someone can help us. This is the case:
We have created a SharePoint intranet site and made it the root site. We then added the site to the Viva Connections integration in Teams, as an app. On this site we have a couple of custom webparts that we created. One of the webparts have been used in many intranet sites and haven't had these problems so far. The problem also isn't occurring on SharePoint itself.
The problem is connecting to the Graph API, the token doesn't seem to be retrieved and thus the API requests are not even send to the Graph API.
Environment details:
- Microsoft Egde version 115.0.1901.183 (Official build) (64-bit)
- SPFx 1.17.4
- Node 16.15.1
- NPM 8.11.0
The error I'm getting:
Uncaught (in promise)
Error: Token request previously failed
at new t (chunk.aadTokenProvider_en-us_445a72773ba77a61be93.js:1:1514)
at e._getTokenInternal (chunk.aadTokenProvider_en-us_445a72773ba77a61be93.js:1:3567)
at e.getToken (chunk.aadTokenProvider_en-us_445a72773ba77a61be93.js:1:2372)
at sp-pages-assembly_en-us_c3c628b67d521769ee27f473c0ed9543.js:76:647657
The request that might be the problem:
Results in an 500 internal server error with the following message:
{
"odata.error":
{ "code": "-1, System.AggregateException",
"message": {
"lang": "en-US",
"value": "One or more errors occurred."
}
}
}
I found this issue #7884 which seems to be related to mine or at least gives the same error, but the resolution there doesn't apply here sadly. The manifest is already in the right format and with the correct data. Also cross referenced the manifest with other, working tenants
At this point I have no clue on what the cause of the issue is, could any of you help me with this problem?
Kind regards,
Arjen
Hi SpWebDev,
The issue has been resolved, see this solution: https://github.com/SharePoint/sp-dev-docs/issues/9099#issuecomment-1701406090
- SpWebDevCopper Contributor
Vighough I’m also running into this issue with the PnP modern search webpart when accessed via the teams mobile app in iOS. What’s weird is it will work for stretches of time, and then break seemingly randomly.
I’m seeing the same call throw an error, but the error reason varies.
Looking for a solution as well. - VighoughBrass Contributor
Hi SpWebDev,
The issue has been resolved, see this solution: https://github.com/SharePoint/sp-dev-docs/issues/9099#issuecomment-1701406090