+ Start a Discussion
kvm1231kvm1231 

Difference between Named credentials and remote site settings?

Hi,

Could you please let me know what is the difference between Named credentials and remote site setting and which case we will prefer these.

Thanks in advance
KVM
DeepthiDeepthi (Salesforce Developers) 
Hi Kvm,

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.

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=named_credentials_about.htm&type=0 
https://help.salesforce.com/articleView?id=configuring_remoteproxy.htm&type=0

Hope this helps you!
Thanks,
Deepthi
SnehaPriya ShendeSnehaPriya Shende
Hello,
Please refer below for datail information:
1)Named Credentials: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_callouts_named_credentials.htm
2)Remote Site Settings: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_callouts_remote_site_settings.htm