Salesforce Decode
Salesforcedecode
Back to questions
LWCAdvancedlightning-outembedding

Handle LWC in Lightning Out and external sites

Real World Scenario

Marketing site embeds LWC via Lightning Out but authentication session expires silently.

Expected Answer

• Lightning Out app bootstrap with OAuth session • Session refresh strategy before expiry • CORS and CSP configuration on external origin • Minimal Apex surface for external LWCs • Fallback login redirect UX • Security review external embedding attack surface • Performance CDN loading lightning.out.js

Follow-Up Questions & Answers

Click to expand — each follow-up includes a direct, interview-ready answer

Main difference: use case and scale. Lightning Out app bootstrap with OAuth session. Session refresh strategy before expiry. Pick based on your integration pattern and team capability. Lightning Out crosses trust boundary—minimize exposed Apex and monitor session lifecycle. Optimize for scale and operational observability.

Architect Perspective

Lightning Out crosses trust boundary—minimize exposed Apex and monitor session lifecycle.