GiphyAPI
GiphyAPI copied to clipboard
CORS for oEmbed
When calling the oEmbed provider from JavaScript in a browser there are no CORS headers in the response. This obviously causes the browser to block the request. Any chance we can get a response header like the following?
Access-Control-Allow-Origin: "*"
This happens with all oEmbed requests but here is an example url:
https://giphy.com/services/oembed?url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fcant-hardly-wait-kW8mnYSNkUYKc
and the full requst:
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
console.log(xhr.response);
}
}
xhr.open('GET', 'https://giphy.com/services/oembed?url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fcant-hardly-wait-kW8mnYSNkUYKc');
xhr.send();
I ran into this with a PHP library I have been using for years to get the oembed... now it returns the image saying "are you a robot?"
https://github.com/oscarotero/Embed/issues/185#issuecomment-490663024
Hey @cpwinn
We we made changes to CORS header management fairly recently. Please give this a try again and feel free to open the issue if needed. Hopefully those fixes help.
Thanks.
@shwetaatgiphy Looks like this issue is unchanged. You can run the code snippet above in a browser console to reproduce it.
Gottit, thanks for taking a look @cpwinn! I'll forward this to the relevant team now & reach out with any updates they may have
@shwetaatgiphy do you have any updates on this issue?