Answered

Trying to fetch articles but keep getting CORS

  • 6 September 2023
  • 1 reply
  • 126 views

Hello, I am trying to fetch all articles and I keep getting CORS error no matter what I try. I tried to set the headers as mentioned here https://developers.intercom.com/docs/references/rest-api/api.intercom.io/Articles/listArticles/, adding also access allow control origin header but I can’t get the data. I get it in postman with no issue. What am I missing? Working with RTK Query.

icon

Best answer by cameron.gumley 8 September 2023, 03:24

View original

1 reply

Userlevel 2
Badge +3

Hi @Veronika Machackova! Cam from the Intercom Support Engineering team here.

Our system blocks calls to the REST API from browsers any browser that uses CORS and web apps that attempt to make client-side calls (as RTK Query is designed to do). This has been implemented our Product and Security teams to prevent important and sensitive data from being exposed.

In this type of scenario, you would need to make the request on the server-side, then populate that on the client-side directly from your server (assuming that's an option for you) 👍

The client-side functions we have available are listed in our Javascript library, where the risk of exposing any customer-related data is minimized. Note, you can show a specific article using this JS snippet.

Let me know if that answers your question!

Reply