on salesforce side done this work
1) CORS Whitelist Origin set to https://*.herokuapp.com.
2) on sandbox created App dxTest2App
<aura:application access="GLOBAL" extends="ltng:outApp" >
<c:dxTest2 />
</aura:application>
created Component dxTest2
<aura:component access="GLOBAL">
Hello
</aura:component>
On origin Server node js side done this work i have passed oauth.access_token after authentication in index.js file of nodejs. In Index.hjs work to load Lightning app is done.
• for this purpose i have included • created script
The function setupLightning() is called in index.hjs is created in app.js .All needed code for loading done in this.
index.hjs is:
<!DOCTYPE html>
<html>
<head>
<title>TouchCR</title>
<script src="/socket.io/socket.io.js"></script>
<script type="text/javascript">
</script>
</head>
<body onload="setupLightning();">
<form>
<input name="Token" Id="Token" type="hidden" value="{{oauth.access_token}}"/>
<div id="messages" style="background: lightblue; height: 400px; width: 400px;></div>
<div id="future"></div>
<script src="XXXXXXmy.salesforce.com/lightning/lightning.out.js"></script>
<script src="./javascripts/app.js"></script>
</form>
</body>
</html>
app.js code is :-
function setupLightning() {
var oauth_token = document.getElementById('Token').value;
var url = 'https://mcnabb--devsanbox.lightning.force.com';
$Lightning.use("c:dxTest2App", function() {
$Lightning.createComponent("c:dxTest2",
{ label : " Comp" },
"lightning");
}, url, oauth_token);
}
Here is code for loading App in function setupLightning.but i have got this warning while loading component.
WARNING: Callback failed: aura://ComponentController/ACTION$getApplication
WARNING: Callback failed: aura://ComponentController/ACTION$getApplication