All articles

Platform

Named Credentials vs External Credentials in Salesforce

Understand endpoint configuration, authentication and principal access. Diagnose Salesforce callout failures and plan a controlled credential migration.

A correct endpoint URL is not enough to make an authenticated callout work. Check the destination, the external identity and the caller’s permission to use it separately.

Salesforce’s Named Credentials guide separates the current model into an endpoint definition and an external credential. The external credential defines authentication and principals; a user external credential stores encrypted tokens. Several named credentials can reference the same external credential.

Separate the configuration checks

ConfigurationWhat to checkA failure to investigate
Named CredentialEndpoint URL, transport and referenced external credentialWrong host, path or credential reference
External CredentialProtocol and principal configurationWrong authentication flow or external identity
Principal accessThe running user’s permission to use the principalCallout denied before the intended remote operation
External systemToken validity, API scope and resource authorizationRemote authentication or permission failure

Salesforce’s credential glossary describes principal access through permission sets, profiles or permission set groups. Check the identity that runs the callout. The person who configured the credential may not be the scheduled-job or agent execution user.

A remote 403 and a Salesforce principal-access error are different failures. Record the response boundary before changing permissions. Giving the integration more Salesforce access will not fix a remote token that lacks the required API scope.

Choose the external identity for the operation

A named principal uses a shared external identity. A per-user principal associates the callout with an individual user’s credentials. Choose according to who must be represented and authorized in the destination system.

For a shared service identity, limit the remote account to the operations the integration requires. For per-user access, include onboarding, revocation and missing authorization in the operating plan. Neither choice removes the need to authorize the business operation itself.

An agent that runs without an interactive person needs an explicitly supported authentication design. Do not silently fall back to a powerful shared identity when user authorization is missing. Define the intended execution context before wiring the action to a credential.

Keep secrets out of the example and the repository

An Apex callout can reference a configured named credential using an endpoint such as callout:Billing_API/v2/invoices. That name resolves through the org’s credential configuration. The token does not belong in the Apex source or in an article’s sample header.

During deployment, treat metadata and secret population as separate concerns. Salesforce documents populating external credentials and the limits on exposing sensitive values through metadata. Do not assume that deploying a credential definition also deploys a working authenticated connection.

Test the destination path, response status and a permitted operation in the target environment. Redact credentials and private response data before retaining diagnostic evidence.

Migrate one dependency at a time

Salesforce recommends the extensible model and marks legacy named credentials as deprecated. Check the current documentation and your org notices for retirement requirements instead of treating an undated statement as a guaranteed deadline.

Inventory references in Apex, Flow and integration configuration before changing a credential. Create and authenticate the replacement in a sandbox, grant the intended principal access, and exercise each dependent workflow under its real execution user.

Include an expired or revoked authorization and an unauthorized user in the tests. Record how the integration fails and who receives the alert. Keep a controlled rollback path until the new configuration has been verified in the target environment.

For a project with several integrations, use the same record for each: owner, endpoint, execution identity, external principal, permitted operations and recovery procedure. That inventory makes the next credential change much easier to assess.

Keep reading

All articles