I am trying to integrate Lightning Components with an external app using Lightning Out, code is mentioned below. I am getting Cross-Origin Request Blocked error, I have already added https://localhost:8443 in CORS section on SFDC to add localhost whitelisted origin.

Please let me know what could be causing the issue.

$Lightning.use("c:POCApp", function() {
        function(cmp) {
            console.log('component created');
  • Is this issue resolved ? I am facing same issue with lightning out. I have added my domain in CORS (hosted app on heroku) but getting same cors error. – Inder Waraich May 6 '17 at 16:00

You will need a proper HTTPS external url with a domain .Salesforce Lightning Out will not work with local host .

You may want to try using a simple node set up on the Heroku instead .Here is a sample app on Node with Heroku for reference .

  • Thanks Mohith, I will check and update the results on the post. – Sanchit Mittal Sep 6 '16 at 4:53
  • I added the domain name instead of localhost to CORS, but it still did not work. I am also not able to make Rest API calls. I am trying to connect to a developer account. – Sanchit Mittal Sep 6 '16 at 9:19
  • What is the error now?Also the access code should be Bearer sessionId – Mohith Shrivastava Sep 6 '16 at 11:59
  • It is still giving us the same error. Domain not matches Access-Control-Allow-Origin. we have registered the domain in CORS section and other REST APIs are working fine, except for the Lightning Component. We are using Username Password OAuth Authentication and I am using Access Code generated to make this integration. Does that matter? – Sanchit Mittal Sep 7 '16 at 5:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.