Cert++
Close

Named credentials for integration callouts

Key Takeaway

Set your Apex endpoint to a callout: URL so the named credential holds the URL and authentication, and your code holds no credentials.

A named credential is one definition that holds the URL of a callout endpoint and the authentication that endpoint needs. When an Apex callout uses a named credential as its endpoint, Salesforce manages all authentication, so your code doesn't have to. In a custom B2B checkout integration, any custom Apex call that makes outbound HTTP connections must reference a named credential, so no credentials are hard-coded in the code. Checkout integrations cover areas such as pricing, tax, shipping and inventory.

What your code does without a named credential

Without a named credential, your Apex code has to do all of this itself:

  • Hard-code the full https endpoint.
  • Store a username and password.
  • Build the Authorization header, for example a BASIC header made with EncodingUtil.base64Encode.

Coding OAuth by hand is even more complex, which makes OAuth an ideal use case for named credentials.

You can also skip remote site settings for the site defined in the named credential. Callouts to external sites otherwise require remote site settings.

Salesforce Accredited B2B Commerce Developer Professional Study Guide

Checklist progress

0/124Learned

Manage data intelligently with regard to relationships and integrations as needed to support getting a B2B Storefront established and running

0/29

Product bundles versus product sets

Learn this concept

Tiered and volume pricing data model

Learn this concept

WebCart and its related cart objects

Learn this concept

Prepare for the Exam

Play Today's Certle

Study Community

Ask questions and get the latest info from other Salesforce Accredited B2B Commerce Developer Professional studiers.