function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Graham ReidGraham Reid 

Lightning Out and CORS

Having problems getting Lightning Out working.  
Getting this CORS error on sandbox with chrome.  

It looks like the following urls are in play..

https://xxxx--xxx.lightning.force.com
https://xxxx--xxx.cs32.my.salesforce.com
and the external app: https://xxxx-xxxxxx-xx.herokuapp.com

I have tried to list all three in CORS whitelist but still same error.  Any ideas?  Remote site settings needed?

Failed to load https://xxxx--xxx.lightning.force.com/c/Task.app?aura.format=JSON&aura.formatAdapter=LIGHTNING_OUT: Redirect from 'https://xxxx--xxx.lightning.force.com/c/Task.app?aura.format=JSON&aura.formatAdapter=LIGHTNING_OUT' to 'https://xxxx--xxx.cs32.my.salesforce.com/visualforce/session?url=https%3A%2F%2Fxxxx--xxx.lightning.force.com%2Fc%2FTask.app%3Faura.format%3DJSON%26aura.formatAdapter%3DLIGHTNING_OUT' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://xxxx-xxxxxx-xx.herokuapp.com' is therefore not allowed access.

Thanks
Oscar Becerra (Q)Oscar Becerra (Q)
In Salesforce, go to CORS and add the following whitelist origins:
  • https://*.herokuapp.com
  • https://*.force.com (might be needed)
  • https://*.salesforce.com (might be needed)
  • The url from the domain you are implementing that lightning out app, if custom.
Hope that helps.
Troy PrinceTroy Prince
Was this ever resolved? I am experiencing this issue.
Anubhav Sharma 7Anubhav Sharma 7
Any pointers to resolve this error