0

Can someone help me in order to fix the CORS issue. I am successfully able to retrieve the Access Token and with the same access token I can hit the OData endpoint URL to retrieve the result by using postman but in pure JavaScript application I am not able to hit it. It is saying CORS issue in developer console. Can anyone suggest how to fix it. Is this possible and using Finance And Operations Module.

I seriously do not want to create a proxy application in .NET and call the endpoints through this application code. I want a direct call to OData endpoint.

enter image description here

Thanks

Alex Kwitny
  • 11,211
  • 2
  • 49
  • 71
Tanuj
  • 53
  • 1
  • 8
  • Do you face this issue only locally or even when you deploy it in dev/stage/prod environments? Locally, you can get around this by adding extensions on your browser that will add the CORS headers to every request, thus making the browser believe that the server is fine with serving the request. – Anish Nov 01 '20 at 10:12
  • Thanks for the reply. I did not deploy the Javascript App to App Service in Azure Portal yet but I used ngrok to publish the app in internet and ngrok gave me an unique domain. Using the domain, it is the same behavior as of localhost. I also tried to install the extension for CORS in chrome but it did not help. I used this extension https://chrome.google.com/webstore/detail/allow-cors-access-control/lhobafahddgcelffkeicbaginigeejlf?hl=en – Tanuj Nov 01 '20 at 10:39
  • Usually the servers are configured to accept requests from only a set of domains. Adding that extension should've worked I believe. I use it for my local development. Just checking, did you also enable the extension, after installing it? The icon should be colourful and not grey. – Anish Nov 01 '20 at 12:15
  • I have a similar requirement, and I configured the nginx server that my application is served by to also act as a proxy for the requests to the backend. So, my application hits the local endpoint, which forwards the request to the actual backend. You need not write a full fledged application to act as a proxy. I am not sure if that is something that could be done for your application though. – Anish Nov 01 '20 at 12:25

0 Answers0