Announcements

OEmbed API missing CORS headers

Solved!

OEmbed API missing CORS headers

cdrini

It's not possible to hit the oembed endpoint from client-side JS. Try running this in your browser console on any non-Spotify domain:

 

 

await fetch('https://open.spotify.com/oembed?url=https://open.spotify.com/track/6fHxL22apYBSywdSSZlp6h').then(r => r.json())

 

 

You will get a CORS error. For reference, YouTube, SoundCloud, Vimeo have CORS-enabled oembed endpoints.

Reply

Accepted Solutions
Marked as solution

kopiro

Hello @cdrini, thanks for reporting this bug.

Your issue should be resolved now, we have added CORS support to the "/oembed" endpoint.

View solution in original post

3 Replies
Marked as solution

kopiro

Hello @cdrini, thanks for reporting this bug.

Your issue should be resolved now, we have added CORS support to the "/oembed" endpoint.

SWR3

Hi, 

it still doesn't work for playlists. The following example gives the same error.

await fetch('https://embed.spotify.com/oembed?url=https://open.spotify.com/playlist/5uHTCYBvcpQfP234BQwzqT').then(r => r.json())

 

cdrini
Awesome! Thank you for the fix, dev team 🙂

Suggested posts

Env: prod