Skip to main content

CSP Trusted Sites

Explore practical guides and implementation patterns for this topic.

Posts

Topic Salesforce Security
Salesforce Security & Access

Salesforce Remote Site Settings vs. CSP Trusted Sites Explained

💬 In plain words: Think of these as two completely separate security allow-lists that guard different doors. Remote Site Settings give your Salesforce backend server (Apex or Flow HTTP Callout) permission to call an external URL. CSP Trusted Sites (now grouped under Trusted URLs in Salesforce Setup) give the user's web browser (LWC or Aura) permission to fetch data, images, or scripts from an external URL. If an Apex callout fails, check Remote Site Settings or Named Credentials . If a browser request fails inside an LWC, check your CSP Trusted Sites! 📌 Real-Life Example: Imagine you are building a live weather dashboard on an Account page. First, your Apex class tries to fetch weather data from https://api.weather.com , and Salesforce immediately throws a System.CalloutException: Unauthorized endpoint error. Why? Because the Salesforce server blocked the call. The fix is adding a Remote Site Setting (or better yet, a Named Credential). Later tha...
Read article
Topic LWC
Lightning Web Components

How to Call External APIs in Salesforce LWC: Fetch vs. Apex Callouts Guide

In plain words: External API integration in Lightning Web Components (LWC) allows Salesforce components to send requests to third-party web services—such as toll calculation, mapping, or payment gateways. In Salesforce, you can invoke external endpoints either directly from JavaScript using the browser's fetch() API (with CSP Trusted Sites enabled) or securely through an Apex callout using Named Credentials . Connecting Salesforce applications with external web services is a core requirement in logistics, fleet management, and finance. For instance, querying a toll calculation service allows transportation teams to estimate route costs dynamically from an Account or Work Order page. Below, we break down how to configure network permissions and execute external API requests cleanly from an LWC component.
Read article