I am trying to build a simple lightning out on my local host which should be available for guests. I have several issues:

  1. I assume that the user does not need to do any log in of any kind because i am using implements="ltng:allowGuestAccess" in the aura app. However when I open the page i get 401 (Unauthorized).
  2. When i am actually logged in to the instance i am trying to access I get a 'net::ERR_ABORTED 404 (Not Found)' and this appears to be because the scripts that are added to my page from the lightning.out.delegate js file have the wrong base url. The script should be accessing my instance not my local host. e.g. https://localhost:8081/auraFW/javascript/YeF9IbuOAuhiq8yQ65xJFA/aura_prod.js but should be 'https://my-instance--dev1.lightning.force.com/auraFW/javascript/YeF9IbuOAuhiq8yQ65xJFA/aura_prod.js
    So when i set breakpoints in lightning.out.delegate and correct all the script that get added to page I do come get very limited access to the target component.
    <aura:application access="GLOBAL" extends="ltng:outApp" implements="ltng:allowGuestAccess">
         <aura:dependency resource="c:auraLightingOutTest"/>
    <c:meshSupport recordId="5000E00000GzpUEQAZ" isTest="false" />
    <h1>Lightning Out App</h1>
    <div id="lightning"></div>
    <script src="https://my-instance--dev1.my.salesforce.com/lightning/lightning.out.js"></script>
         $Lightning.use("c:lightningOutTest", function() {
            window.$Lightning.createComponent("c:auraLightingOutTest", {},
                  function(cmp) {
                    console.log("LWC component was created");
                    // do some stuff

How should this work so a guest can have access? Any help at all would be appreciated.

2 Answers 2


For getting this to work with the guest user, you will need Experience Cloud Site (Digital Experience, previously communities) enabled and use the site URL.

You cannot use the domain of your org, instead, it is the Experience cloud site domain.

The details are documented here.

The script URL will be as below

<script src="https://yourExperienceDomain/ExperienceURL/lightning/lightning.out.js"></script>

The endpoint URL takes the form https://yourExperienceDomain/experienceURL/

  • Thanks a lot. Ill try this out.
    – Dane
    Commented Sep 7, 2021 at 13:57
  • 1
    Worked great. Thanks again.
    – Dane
    Commented Sep 7, 2021 at 14:35

An important know issue is that if you are using guest user access and you are also logged on to your experience community, you will get 404s for bootstrap and inline.js. https://issues.salesforce.com/issue/a028c00000qQ2LVAA0/lightning-out-app-implementing-ltngallowguestaccess-fails-to-load-inlinejs-and-bootstrapjs-when-the-customer-is-logged-into-his-community-app

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .