'Unable to run lightning out in external website

I'm trying to add my lightning out code in external website. I use access token to access the component in lightning out. But it is giving an error:

CORS policy: No 'Access- Control-Allow-Origin' header is present on the requested resource

let token = document.getElementById('getToken').value; 
     $Lightning.use("c:sampleLightApp", function() {
        $Lightning.createComponent("c:patientLogin", {},
              "lightning",
              function(cmp) {
                console.log("LWC component was created");
                // do some stuff
              }
          );
        },
      'https://fullbox-hb.cs200.force.com/',
      token
      );

Can anyone help me how to fix this CORS policy issue.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source