You need to sign in to do that
Don't have an account?
Include Lightning Component in Sites VisualForce Page
I've started dabling in Lightning Components and worked through a tutorial last year and have done one of the trailheads a few days. So I know how to code basic Lightning components and apps. And I see in the metadata that these become AuraDefinitionBundles. I also so an example of some code where a bit of JS is added to an empty VF page and that always a Lightning Component to be spun up inside a VF page.
What I want to do is take an exist VF page that is exposed to the internet as a SF "Sites" application and port it to Lightning. What I included in the prior paragaph leads me to believe the page is codable. Here's what I don't know. When a Sites application is configured, you have to tell it what it has access to-- VF pages, Apex controllers, objects and fields, etc. I don't know how you would give it access to the Aura bundle. (Unless it's totally implicit and you don't have to and it automatically gets acces.)
Can anyone address the question of how to configure and deploy Sites application that includes a VF page that spins up an Lightning Component?
What I want to do is take an exist VF page that is exposed to the internet as a SF "Sites" application and port it to Lightning. What I included in the prior paragaph leads me to believe the page is codable. Here's what I don't know. When a Sites application is configured, you have to tell it what it has access to-- VF pages, Apex controllers, objects and fields, etc. I don't know how you would give it access to the Aura bundle. (Unless it's totally implicit and you don't have to and it automatically gets acces.)
Can anyone address the question of how to configure and deploy Sites application that includes a VF page that spins up an Lightning Component?
To be more specific, when you create a Sites application, it gets a special Public profile. You can then edit that profile. The question would then be on that Public Access Settings profile, can you grant permissions to Lightning Apps and if so how?
To be more general, on any profile you can grant access to VF pages and Apex classes. Or you can come at it from the Page or Class definition in setup and use the Security feature to select which profiles have access. I don't see any Security feature on the Lightning components listed under Setup->Development. So how is security on Lighning components maintained?
Did you got any solution for this ? With Spring 16 release, there is Lightning Out coming. That may be used to resolve the issue.
However, want to know if you have any workaround before that ?
Thanks,
Dayanand
This is the documentation that I've been following:
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/components_visualforce.htm
Mike
+1
Currently, I cannot get lightning components to work with a publically exposed visualforce page aka site in our Sandbox Org. I get a 401 unauthorized error.
Testing the VF Page on its own (logged in as admin), shows that lightning out does request the App via a faulty url (visual.force.com instead of lightning.force.com)
These errors might not be related to each other or rather one might solve the other. Nonetheless, I would appreciate a clear statement on: What do I need to do to get lighting components on my public sites.
Cheers,
Sz
Sz, thanks for doing the experiment. I've had other pressing priorities and haven't been able to. What you experienced is what I was worried about. For Sites, you have explicitly grant access to VF pages and Apex Classes. But there's no place (yet) to explicitly grant access to Lightning Apps. So I don't know if it even has a chance of working at all. The only thing I could think of is if there's a hack to override that URL that you mentioned is bad.
I wish we could get SF to speak up on these issues.
Does anyone know if Summer '16 will allow Lightning pages in Sites?
From what I understand, LightingOut will let a Lightning App run anywhere, even when not served by SF. But there may still not be a way to get Sites to serve the Lighning buddle. Perhaps the workaround would be to declare that guess access is allowed and then just server the bundle from an external web server.
I wonder if this would work--
I managed to embed a small lightning component inside a visual force page and displayed it on my sample force.com site, but it still needs authentication, I didn't manage to implement "ltng:allowGuestAccess"(any input is highly appreciated here).
I used Lightning Out( "ltng:outApp") below to embed my lightning component to my VF page and then used site login to navigate to my visualforce page.
VF page
<apex:page showHeader="false" standardStylesheets="false">
<apex:includeLightning />
<div style="width:100%;height:100px;" id="lexContainer">
<div style="height:6rem;" id="sliderDemo">
<div role="status" class="slds-spinner slds-spinner_medium" >
<span class="slds-assistive-text">Loading</span>
<div class="slds-spinner__dot-a"></div>
<div class="slds-spinner__dot-b"></div>
</div>
</div>
</div>
<script>
$Lightning.use("c:testaura", function() {
$Lightning.createComponent("c:smuzi",
{},
"lexContainer",
function(cmp) {
document.getElementById("sliderDemo").style.display = 'none';
});
});
</script>
</apex:page>
<aura:application access="Global" extends="ltng:outApp" implements="ltng:allowGuestAccess">
<aura:dependency resource="c:smuzi" />
</aura:application>
AND MAIN))) APEX
public without sharing class FetchOpportunitiesTabController {
@auraEnabled
public static List<Opportunity> fetchOpportunities(id account_id) {
List<Opportunity> Opportunities = [SELECT Name, Amount, CloseDate, Probability, StageName, ExpectedRevenue FROM Opportunity WHERE AccountId = : account_id ];
return Opportunities;
}
}