I am struggling on how to expose lightning apps in force.com sites
As per one of the answers in this link I should be able to expose lightning apps on force.com sites :
Expose Lightning .app publicly?
I get a 500 error when the site accesses the lightning app. The same app renders fine on the visualforce page. What am I missing here?
Is it even possible to expose a lightning app through a public sites without authentication?
Lightning App:
<aura:application extends="ltng:outApp" implements="ltng:allowGuestAccess" access="GLOBAL">
<aura:dependency resource="c:caseSearchComponent"/>
</aura:application>
VF Page used in force.com site:
<apex:page sidebar="false" showheader="false">
<apex:includeLightning />
<div id="lightning" />
<script>
$Lightning.use("c:Lightningappforsite", function() {
$Lightning.createComponent("c:caseSearchcomponent",
"",
"lightning",
function(cmp) {
// do some stuff
});
});
</script>
</apex:page>
Output of component inside the VF Page:
Looking further in the console i see invalid session, looks like salesforce is expecting authentication to access the lightning component.
Console shows invalid session when i try to look at the raw request:
while(1); {"defaultHandler":"function(token) {try{$A.clientService.invalidSession(token);}catch(e){window.location.reload(true);}}","event":{"descriptor":"markup://aura:invalidSession","attributes":{"values":{}},"eventDef":{"descriptor":"markup://aura:invalidSession","type":"APPLICATION","xs":"I","superDef":{"descriptor":"markup://aura:applicationEvent"},"attributes":{"newToken":{"name":"newToken","type":"aura://String","xs":"I"}}}},"exceptionEvent":true}
extends="ltng:outApp" implements="ltng:allowGuestAccess"
in your application definition