recombee / js-api-client

JavaScript client for easy use of the Recombee recommendation API from frontend
23 stars 11 forks source link

Getting CORS #20

Closed psdev0 closed 5 months ago

psdev0 commented 5 months ago

Hi there, I tried to call AddDetailView in my react app but got a CORS error.

this is my code for it:

  useEffect(() => {
    if (user?.id && character?.id) {
      const r = new recombee.AddDetailView(user?.id, String(character?.id));
      r.timeout = 10000;
      client.send(r);
    }
  }, [user?.id, character?.id]);

I was testing it on localhost.

I tried to look for setting/whitelisting my doing in the Admin Panel but got nothing there. It would be great if you could guide me on how to fix this issue to test my API.

OndraFiedler commented 5 months ago

Hi @psdev0, we will need to check the requests sent to the API.

Can you please provide us with the ID of your database either here or at support@recombee.com?

psdev0 commented 5 months ago

Got it! I was using a private token where a public token was needed. Now that's fixed.

Thanks for your time and help. Will be closing this as resolved.