Before you embed a Lightning Out 2.0 app into an external app, configure some security-related and administrative settings in Salesforce and in your external app. These settings allow Lightning Out 2.0 inline frames (iframes) to load in the external app.
Required Editions
| Available in: Lightning Experience |
|
Available in: Professional, Enterprise, Performance, Unlimited, all Agentforce 1 Editions, and Developer Editions |
| User Permissions Needed | |
|---|---|
| To modify My Domain and session security settings: | Customize Application |
| To modify CORS settings: | Modify All Data AND Customize Application |
Before You Begin
- Make sure that your external app supports inline frames (iframes).
- Make sure that your external app is secure and uses HTTPS.
- Make sure that third-party cookies are allowed in your external app and your users’ browsers.
Configure Session Settings
Add the domain names of your external apps to the Trusted Domains allowlist in Session Settings.
- From Setup, in the Quick Find box, enter Session Settings, and then select Session Settings.
- In the Trusted Domains for Inline Frames section of the Session Settings Setup page, click Add Domain.
-
Enter the domain of an external app that will host your Lightning Out 2.0 app.
Acceptable URI formats are example.com, https://example.com, and *.example.com.
- Select Lightning Out from the IFrame Type dropdown list.
- Save your changes.
- Repeat steps 2-5 for any other domains that will host your Lightning Out 2.0 app.
Enable Third-Party Cookies
Make sure that cross-domain Salesforce session cookies are enabled.
- From Setup, in the Quick Find box, enter My Domain, and then select My Domain.
- In the Routing and Policies section, make sure that the “Require first-party use of Salesforce cookies” setting is deselected.
Configure CORS Settings
Add the domain names of your external apps to the Cross-Origin Resource Sharing (CORS) allowlist.
This step is required only if your external app uses the Lightning Out 2.0 UI Bridge access point for client-side authentication. If your external app uses its own server-side authentication flow to generate a Salesforce frontdoor URL, this step isn’t required. See Set Up Authentication for Lightning Out 2.0.
- From Setup, in the Quick Find box, enter CORS, and then select CORS.
- To add a domain to the CORS allowlist, click New.
-
For Origin URL Pattern, enter the domain of the external app that will host your Lightning
Out 2.0 app.
The origin URL pattern must include the HTTPS protocol and a domain name.
- Repeat steps 2 and 3 for any other domains that will host your Lightning Out 2.0 app.
- In the Cross-Origin Resource Sharing (CORS) Policy Settings section, click Edit.
- Select Enable CORS for OAuth endpoints.
- Save your changes.