[SalesForce] CORS issue with lightning out used in external website

I have deployed a nodejs application on Heroku, it has one lightning component embedded using lightning out. But I am getting the below error:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote >resource at https://myorg-dev-ed.lightning.force.com/c/sampleapp.app?>aura.format=JSON&aura.formatAdapter=LIGHTNING_OUT. (Reason: CORS header 'Access->Control-Allow-Origin' missing).

I have added my domain in CORS as well.

All works fine, If I login into Salesforce in next tab of browser to this application.

How I can resolve this if I don't login to Salesforce using the same browser.

Best Answer

Have you checked the url that you access the dependency app on - you may get a different url back from login flow. See my response Lightning Out session expired from external page

Related Topic