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
Tarun DasTarun Das 

Saleesforce Creds is being sought even after Lightning Out ltng:allowGuestAccess is applied

Hi ,

My dev endpoint
https://dev02-dev-dev-ed.lightning.force.com/c/MorningFatMelterApplication.app is still seeking  for salesforce creds even when i have applied Lightning Out ltng:allowGuestAccess 
Here is the code for app
<aura:application extends="ltng:outApp" implements="ltng:allowGuestAccess" access="global"> 
    <c:MorningFatMelter/>
	
</aura:application>

Here is cmp code
<aura:component >  
    
    <aura:attribute name="backgroundImageURL" type="String" default=""/>
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>   
    <div style="{!'position: relative; height: 30vh; background:' + v.backgroundColor + ' url(' + v.backgroundImageURL +') no-repeat;background-position: center;background-size: cover;'}">
        
    </div>
    
  
    
    
    <aura:attribute name="options" 
                    type="List" 
                    default="[ {'label': 'Not Sure', 'value': 'option1'}, 
                             {'label': 'Greater Than 40 lb', 'value': 'option2'}, 
                             {'label': 'Less Than lb', 'value': 'option2'}, 
                             {'label': 'Will Decide Later', 'value': 'option2'}, ]"/> 
    <aura:attribute name="value" 
                    type="String" 
                    default="option1"/> 
    
    <div class="slds-align_absolute-center" >
        <h1>How Much Weight You Want To Loose</h1>
    </div>
    <br/>
    <div class="slds-align_absolute-center" >
        <lightning:radioGroup name="radioGroup" 
                              label="Select Your Option Then Click Next" 
                              options="{! v.options }" 
                              value="{! v.value }" 
                              type="radio"/> 
    </div>
    <br/>
    <div class="slds-align_absolute-center" >
        <lightning:button label="Previous"
                          iconName="utility:left"
                          iconPosition="left"
                          variant="brand"
                          onclick="{!c.prevPage}"/>
        <lightning:button label="Next"
                          iconName="utility:right"
                          iconPosition="right"
                          variant="brand"
                          onclick="{!c.nextPage}"/>
    </div>
        
</aura:component>

Here is creds seeking page
salesforce creds sought

As per docs below ,i just need to have communities enabed which is already active for my org
https://releasenotes.docs.salesforce.com/en-us/spring17/release-notes/rn_lightning_apps_public.htm

Any help is appreciated

Regards,
Tarun
Ramesh DRamesh D
@Tarun,
Make sure you have added scripts on the external page where you rendering the lightning component and the community URL in the script
//Lightning out js
<script src="https://myhult.force.com/hulthousing/lightning/lightning.out.js"></script>

//Div to render the component
<div id="lightningLocator"></div>

//Script to place app/component
 <script type="text/javascript">
      $Lightning.use("c:HH_Application",    // name of the Lightning app
        function() {                  // Callback once framework and app loaded
          $Lightning.createComponent(
            "c:HH_Component", // top-level component of your app
            { },                  // attributes to set on the component when created
            "lightningLocator",   // the DOM location to insert the component
              function(cmp) {
                // callback when component is created and active on the page
              }
            );
          },
        'https://yourinstance.force.com/community'  //Community endpoint(https://yourinstance.force.com/community)
      );
    </script>

I hope you find the above solution helpful. If it does mark as best answer to help others too.
Thanks,
Ramesh D
 
Tarun DasTarun Das
@Ramesh
I am using below code as per your request 
 
<aura:application access="GLOBAL" extends="ltng:outApp">
    
    <aura:dependency resource="c:MorningFatMelter"/>
    //Lightning out js
<script src="https://morningfatmelter-developer-edition.na40.force.com/lightning/lightning.out.js"></script>

//Div to render the component
<div id="lightningLocator"></div>

//Script to place app/component
 <script type="text/javascript">
      $Lightning.use("c:MorningFatMelter",    // name of the Lightning app
        function() {                  // Callback once framework and app loaded
          $Lightning.createComponent(
            "c:MorningFatMelter", // top-level component of your app
            { },                  // attributes to set on the component when created
            "lightningLocator",   // the DOM location to insert the component
              function(cmp) {
                // callback when component is created and active on the page
              }
            );
          },
        'https://morningfatmelter-developer-edition.na40.force.com'  //Community endpoint(https://yourinstance.force.com/community)
      );
    </script>
	
</aura:application>

But i am getting error in lightning page as
User-added image
Ramesh DRamesh D
@Tarun,
I still see few things missing in your code 

1) add the ltng:allowGuestAccess interface to your Lightning Out dependency app. 
<aura:application access="GLOBAL" extends="ltng:outApp" 
    implements="ltng:allowGuestAccess">
2) important addition that you must use one of your org’s community URLs for the endpoint. The endpoint URL takes the form https://yourCommunityDomain/communityURL/
'https://universalcontainers.force.com/ourstores/'  // Community endpoint
More info follow this article from salesforce 
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/lightning_out_public_apps.htm


Thanks
Ramesh

 
Tarun DasTarun Das
@Ramesh regarding your 2nd point ,did you mean to use the url mentioned in communties settings like below or is there any other way to get or develop community url
User-added image
Tarun DasTarun Das
created a community based  on trailhead and created a new community ,i see Aura page Loading only,here is the code
User-added image
code for morningfatmelterapplication.app in detail below
 
<aura:application access="GLOBAL" extends="ltng:outApp">
    
    <aura:dependency resource="c:MorningFatMelter"/>
    //Lightning out js
<script src="https://morningfatmelter-developer-edition.na40.force.com/lightning/lightning.out.js"></script>

//Div to render the component
<div id="lightningLocator"></div>

//Script to place app/component
 <script type="text/javascript">
      $Lightning.use("c:MorningFatMelter",    // name of the Lightning app
        function() {                  // Callback once framework and app loaded
          $Lightning.createComponent(
            "c:MorningFatMelter", // top-level component of your app
            { },                  // attributes to set on the component when created
            "lightningLocator",   // the DOM location to insert the component
              function(cmp) {
                // callback when component is created and active on the page
              }
            );
          },
        'https://morningfatmelter-developer-edition.na40.force.com/cloudkicks'  //Community endpoint(https://yourinstance.force.com/community)
      );
    </script>
	
</aura:application>

output
aur page loading

Here is community url
http://https://morningfatmelter-developer-edition.na40.force.com/cloudkicks
User-added image


above url is created based on below trail head steps ,please let me know why this code not working still?
https://trailhead.salesforce.com/en/content/learn/modules/community_rollout_impl/community_rollout_impl_setup_com