Hello,
When I call Spotify API (https://api.spotify.com/v1),
I have the following error:
Access to XMLHttpRequest at 'https://api.spotify.com/v1/me' from origin 'https:XXX' has been blocked by CORS policy: Request header field pragma is not allowed by Access-Control-Allow-Headers in preflight response.
For information it worked before and since yesterday I have the error.
I created a new app, but the same.
Do you have an idea to unblock me?
For information, I use Axios in VueJS
My code:
const service = axios.create({ baseURL: "https://api.spotify.com/v1" });
letresponse = null;
await service
.get(`${path}`, {
headers: {
'Authorization': `Bearer ${access_token}`,
'Content-Type': 'application/json'
}
})
.then(result => {
response = result. data;
})
.catch(error => {
console.log('error spotify api',error);
})
Thank you.
Thank you Ximicc,
but it's not working 😞
Access to XMLHttpRequest at 'https://api.spotify.com/v1/me' from origin 'https://XXX' has been blocked by CORS policy: Request header field pragma is not allowed by Access-Control-Allow-Headers in preflight response.
I've this error if I add :