Discussions

Ask a Question
Back to All

CORS policy error in get request

const video = useCallback(async () => {
const options = {
method: "GET",
headers: { accept: "application/json", "x-api-key": apiKey },
};

fetch(`https://api.heygen.com/v1/video_status.get/${videoUrl}`, options)
  .then((res) => res.json())
  .then((res) => console.log(res))
  .catch((err) => console.error(err));

});

i am using this function block in javascript to fetch the details by giving the video_id received from post request.
But, this shows error:

Access to fetch at 'https://api.heygen.com/v1/video_status.get/' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.

Anyone help Plz