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
Vasu K 17Vasu K 17 

Difference between Named credentials, remote site setting and connected app

Hi, 

I am little bit confusion with Named credentials, remote site setting and connected app, Can you please let me know the exact difference and also need which case we preferring.

Thanks in advance
Raj VakatiRaj Vakati
Named Credentials: A named credential specifies the URL of a callout endpoint and its required authentication parameters in one definition. To simplify the setup of authenticated callouts, specify a named credential as the callout endpoint. If you instead specify a URL as the callout endpoint, you must register that URL in your org’s remote site settings and handle the authentication yourself. For example, for an Apex callout, your code would need to handle authentication, which can be less secure and especially complicated for OAuth implementations.

https://help.salesforce.com/articleView?id=named_credentials_about.htm&type=0

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_callouts_named_credentials.htm

http://blog.lkatney.com/2016/01/14/named-credentials-a-turning-point-for-callouts-in-apex/

https://blog.enree.co/2016/03/salesforce-apex-lets-play-with-named.html


Remote Site Settings: When you want to access the external sites in your Salesforce application using callouts, webservices, etc... You need to add that in the Remote Site Settings. This is just a security that force.com platfom is going to check.
Before any Visualforce page, Apex callout, or JavaScript code using XmlHttpRequest in an s-control or custom button can call an external site, that site must be registered in the Remote Site Settings page, or the call will fail. 


https://help.salesforce.com/articleView?id=configuring_remoteproxy.htm&type=0