CORS error in Add/Update custom code api

   const response = await fetch(
      `https://api.webflow.com/v2/pages/${currentPageID.id}/custom_code`,
      {
        method: "PUT",
        headers: {
          Authorization:
            "MY_AUTH",
          "Content-Type": "application/json",
        },
        body: JSON.stringify({
          scripts: [
            {
              id: "css_slider",
              location: "header",
              version: "1.0.0",
            },
          ],
        }),
      }
    );

This is a designer extension application, in this i am using the Add/Update custom code API to add a script to the head tag, but am facing this issue:


I get the same CORS error on local host as well as deployed version