i'm trying to consume deezer api, but idk how to do it. I already read the documentation, learn how I can get my token, but when I'm trying to request i got this error:
Access to fetch at 'https://api.deezer.com/album/302127' from origin 'null' 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.
how can I solve this? url: https://api.deezer.com/album/302127
idk the problem with my request.
async function getAlbum() {
try {
const response = await fetch("https://api.deezer.com/album/302127", {
headers: {
"Authorization": "Bearer " + access_token
}
});
const data = await response.json();
console.log(data);
} catch (error) {
console.log(error);
}
}
getAlbum();