The API does not work from client-side Javascript because of CORS issues.

A place for developers to advertise their TheTVDB.com enabled app and get help from other developers with the API.
Post Reply
la55u
Posts: 1
Joined: Sun Aug 02, 2020 6:51 am

Sun Aug 02, 2020 7:17 am

Code: Select all

const res = await fetch(
        "https://api.thetvdb.com/search/series?name=money%20heist",
        {
          headers: {
            Authorization: `Bearer ${token}`,
          },
        }
      ); 
const data = await res.json();
console.log("data:", data);
The above simple GET request does not work from my React (client side code) because the API doesn't handle the pre-flight OPTIONS request that the browser makes before the actual GET request. However the exact same request works if I make the same request but from my Node backend. This behaviour can't be disabled on our side, only on TVDB's (server) side. There were multiple issues reporting it years ago, so my question is when can we expect a fix for this? I might be wrong but I think a simple Access-Control-Allow-Origin:* response header for the OPTIONS request would solve all the issues. Thank you.
Post Reply