Open svrijsewijk opened 1 month ago
I have the same issue.
My code:
return await this.context.aadHttpClientFactory
.getClient(this.resourceEndpoint)
.then((client: AadHttpClient) =>
client
.post(this.externalApiAuthUrl, AadHttpClient.configurations.v1, httpClientOptions)
.catch(r => { // "One or more errors occurred."
console.log(r);
})
.then((response: HttpClientResponse): Promise<string> => response.json())
).then(token => token);
@svrijsewijk , Please check this answer, it helps for me - https://github.com/SharePoint/sp-dev-docs/issues/9099#issuecomment-1701406090
Target SharePoint environment
SharePoint Online
What SharePoint development model, framework, SDK or API is this about?
π₯ SharePoint Framework
Developer environment
None
What browser(s) / client(s) have you tested
Additional environment details
Describe the bug / error
We have created a Webpart for SharePoint. This webpart loads a button in SharePoint document collections when items are selected. Pressing the button calls our own separate API. A token is included in the header of the request.
Before the request is initiated a token is fetched.
This produces a GET request that fails with error
500
Error response:
where api://iprox** is an app registration in our tenant.
I've found similar issues: https://techcommunity.microsoft.com/t5/sharepoint-developer/spfx-webparts-not-able-to-acquire-token-for-graph-api-in-teams/m-p/3886488 which leads to: https://github.com/SharePoint/sp-dev-docs/issues/9099#issuecomment-1701406090
and this one: https://github.com/SharePoint/sp-dev-docs/issues/4915
Neither proposed solutions by others have any effect on the error.
We're kind of lost here at the moment.
Steps to reproduce
1. 2. 3.
Expected behavior
A 200 status code after which the webpart can use the token in its headers