Announcements

Help Wizard

Step 1

NEXT STEP

FAQs

Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...

VIEW ALL

Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...

VIEW ALL

Cross-Origin Request Blocked: CORS request did not succeed

Cross-Origin Request Blocked: CORS request did not succeed

Hi, I'm currently having an issue where any Spotify API requests I send from client-side JavaScript are resulting in CORS errors. For example, a request to get a user's saved tracks would result in the following error:

 

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://api.spotify.com/v1/me/tracks?offset=0&limit=50. (Reason: CORS request did not succeed).

 

The code (example snippet below) is running on GitHub Pages, which does have the access-control-allow-origin: * header needed to allow such requests, so I'm not sure what the problem is. If I try to send the same request from server-side NodeJS code or through API testing software such as Insomnia it goes through just fine, but I need to be able to send the request without the use of a server for this particular app.

 

axios.get("https://api.spotify.com/v1/me/tracks?offset=0&limit=50", {
    headers: {
        Authorization: "token here (removed for post)"
    },
});

 

I've tried everything I could think of, any help would be much appreciated.

Reply
0 Replies

Suggested posts