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
Raghu Natha 2Raghu Natha 2 

Unable to get data from Apex class in lightning Out component

Hi,

Created a Lightning Web Component which gets the contacts on click of a button from an Apex class. The functionality works as expected when the component is used inside salesforce.

When the same component is used outside salesforce, the component is unable to fetch data.
Code: Lightninhout html code (https://github.com/EasyLearnJava/HerokuStaticSite/blob/master/home.html)
Below is my lightning out component deployed to Heroku
https://demoout.herokuapp.com/home.html

When I click on the button "Load Contacts" I see the below error.
Access to XMLHttpRequest at 'https://rnrcommunities-developer-edition.na85.force.com/Test/aura?r=1&aura.ApexAction.execute=1' from origin 'https://demoout.herokuapp.com' has been blocked by CORS policy: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.