CORS error for azure digital twins core on node web application

Antonio Garofalo 0 Reputation points
2023-07-03T09:10:31.56+00:00

Hello, I'm working on a web application on NodeJS and I can't seem to get it working on browsers because of CORS. I know they are a browser restriction, but on this link it says that they shouldn't be a concern for node applications. Also, i've been using node vite to run a server, which by default allows any origin. The only way I get it working is if I run it on safari and disable cross-origin restrictions from developer options, and even then, some functions work and some don't.

Azure Digital Twins
Azure Digital Twins
An Azure platform that is used to create digital representations of real-world things, places, business processes, and people.
231 questions
JavaScript API
JavaScript API
An Office service that supports add-ins to interact with objects in Office client applications.
1,001 questions
{count} votes

1 answer

Sort by: Most helpful
  1. AshokPeddakotla-MSFT 34,701 Reputation points
    2023-07-03T13:11:10.69+00:00

    Antonio Garofalo Greetings & Welcome to Microsoft Q&A forum!

    Your understanding is correct.

    Azure Digital Twins doesn't currently support Cross-Origin Resource Sharing (CORS). As a result, this library cannot be used to make direct calls to the template service from a browser.

    Please see the response on this thread https://learn.microsoft.com/en-us/answers/questions/747510/cors-error-when-i-query-azure-adt-using-rest-apis.

    you can try using a tool like Postman to test your server's API endpoints and see if you're getting the appropriate CORS headers. This can help you isolate the issue and determine if it's a server-side or client-side problem.

    Let us know if that helps or have any further queries.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.