Saturday, 13 May 2017

AEM - Salesforce lightning component - Access-Control-Allow-Origin

When I try to access salesforce lightning components in AEM, I was not able to access the lightning script from AEM server, I got below error in browser console.

Issue:

XMLHttpRequest cannot load https://AAAAAA.lightning.force.com/lightning/lightning.out.js. 
Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' 
header is present on the requested resource. Origin 'https://localhost:5544' is therefore not allowed access.

Solution:

We need to whitelist the origin i.e. our aem server in salesforce. 
  • Goto salesforce.com site, click on Setup -> search for CORS
  • Goto CORS console, give the AEM server url pattern, in my case it is https://localhost:5544



1 comment :

  1. The Blog gave me idea about the salesforce My sincere thanks for sharing this post and please continue to share this kind of post
    salesforce integration

    ReplyDelete