hi, I'm having a very weird issue related to CORS which I've had before and fixed, but I can't seem to fix it again. I'm trying to do a GET request to an API, but i'm getting this error:
Access to fetch at 'https://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=APIKEY' from origin 'https://MYWEBSITE.com' has been blocked by CORS policy: 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.
I've been trying to fix it for the entire day but nothing works and I cannot find any new information online. this is how i'm doing my request:
fetch("https://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=APIKEY&steamids=MYID").then(function(response) {
// Convert to JSON
return response.json();
}).then(function(j) {
// Yay, `j` is a JavaScript object
console.log(JSON.stringify(j));
}).catch(function(error) {
console.log('Request failed', error)
});
help would very much be appreciated