1

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() {
    $Lightning.createComponent(
        "c:POC",
        {},
        "myDivId",
        function(cmp) {
            console.log('component created');
            console.log(cmp);
        });
    },"https://{MyDomain}.my.salesforce.com","AccessCode");
1
  • 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. May 6, 2017 at 16:00

1 Answer 1

2

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 .

4
  • Thanks Mohith, I will check and update the results on the post. Sep 6, 2016 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. Sep 6, 2016 at 9:19
  • What is the error now?Also the access code should be Bearer sessionId Sep 6, 2016 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? Sep 7, 2016 at 5:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .