Hi guys
I already wrote @benjamin about this, but I decided to write in here, as maybe someone else had the same problem and already solved it.
I am currently trying to build a remote control for Syrinscape, that I can integrate into foundryvtt (https://foundryvtt.com/), therefore I am trying to access the API with javascript.
While I can get the play and stop functions to run without problems, I cannot read from the API remotely.
Here is my basic fetch command (replace AUTH with the Auth token)
fetch(āhttps://www.syrinscape.com/online/frontend-api/soundsets/29/?format=json&auth_token=ā+AUTH)
.then((response) => {
return response.json();
})
.then((data) => {
console.log(data);
});
generates an error:
āAccess to fetch at 'https://www.syrinscape.com/online/frontend-api/soundsets/29/?format=json&auth_token=AUTH from origin āhttp://127.0.0.1:5500ā has been blocked by CORS policy: Response to preflight request doesnāt pass access control check: No āAccess-Control-Allow-Originā header is present on the requested resource. If an opaque response serves your needs, set the requestās mode to āno-corsā to fetch the resource with CORS disabled.ā
when I now set the mode to no-cors, i only get the opaque response with no data in it.
Can anyone point me the right way, so I can access the API from a 3rd party script?
Thanks in advance.