Forum Discussion
Geeting CORS in API while calling inside Teams APP TAB
Getting CORS in API while calling inside Teams APP TAB Calling API in Teams App TAB
const u = `${domain}/api/login.json`; fetch(u, requestOptions) .then(resp => { }
While calling API we are getting CORS
Despite receiving correct responses in the network tab, the app is receiving different responses, possibly due to the restricted Teams SDK..
6 Replies
- skanderCopper Contributor
Trying to do the same thing, make a 3rd Party API calls from teams tab but getting CORS error, that mean that the call need to be done from a backend, it is not possible in my case. After researching potential solutions, there is azure relay, and it is not free.
- Prasad_Das-MSFT
Microsoft
- ankur745Copper ContributorHey basically I want to call 3rd party API.. so how i can simply call API?
- Prasad_Das-MSFT
Microsoft
ankur745 -
Teams Platform/SDK doesn't do anything to interfere with AJAX requests made by apps. CORS is standard mechanism implemented by all browsers that limits cross-origin network calls. If an app is trying to make a cross-origin network request, then the backend API must allow it first by responding correctly to the OPTIONS call. Here is an example:
There is documentation on CORS here:
https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
Could you please provide us Fiddler trace of the request, so that we will be able to point out what the exact issue is?
- ankur745Copper Contributor
Prasad_Das-MSFT No, it's not helpful. I'm receiving data from my server API but Teams SDK not passed that data to me... in code getting type = CORS issue..looks like Teams SDK restricting data . I have attached two screenshots to my question.
Is the team's app tab allowing to call 3rd Party API?