ExternalAuthIdentityProvider defines an identity provider that obtains OAuth tokens for outbound callouts, which are requests from Salesforce to external systems. It controls the authentication protocol, token acquisition flow, endpoints, and request parameters. An ExternalCredential references the provider through its externalAuthIdentityProvider element, so changes to the provider's token acquisition settings can affect callouts using that credential.
The provider definition is distinct from the external credential that references it and from the client credentials used to authenticate to the external system. Installing a provider definition does not, by itself, establish that usable client credentials have been provisioned.
Key Elements
| Element | What the Element Controls |
|---|---|
label |
Required. The name displayed for the external auth identity provider. |
authenticationProtocol |
Required. The authentication protocol for the external system. Allowed values are OAuth and SalesforceDefined. |
authenticationFlow |
Required. The flow used to obtain tokens for protected APIs. Allowed values are AuthorizationCode, ClientCredentials, and SalesforceDefined. |
externalAuthIdentityProviderParameters |
The collection of parameter entries that further configure the provider. These entries are nested configuration, not independently deployable components. |
parameterName |
Required within each parameter entry. Identifies the parameter. |
parameterType |
Required within each parameter entry. Determines the parameter's behavior, such as defining a token endpoint or adding a token request header. |
parameterValue |
Stores a literal value when the selected parameterType calls for one. |
sequenceNumber |
Controls the order in which parameters are applied. Lower numbers have higher priority: 1 takes priority over 2. |
Behavior and Constraints
Access to this metadata type requires either Customize Application or Manage Named Credentials. This administrative permission requirement is separate from successful authentication to the external system.
authenticationProtocol and authenticationFlow work together to define the authentication mechanism and token acquisition flow. The nested parameters provide the additional configuration:
-
Provider endpoints:
AuthorizeUrl,TokenUrl, andUserInfoUrl. -
Authorization request customization:
AuthorizeRequestQueryParameter. -
Token request customization:
TokenRequestBodyParameter,TokenRequestHttpHeader, andTokenRequestQueryParameter. -
Refresh request customization:
RefreshRequestBodyParameter,RefreshRequestHttpHeader, andRefreshRequestQueryParameter. -
Additional authentication configuration:
ClientAuthenticationandIdentityProviderOptions.
These names are values of parameterType. The type determines behavior; parameterName identifies the entry, and parameterValue supplies a literal value when applicable.
When several parameters are present, sequenceNumber controls their application priority. It is not merely a display-order field.
Deployment and Retrieval
Components use the .externalAuthIdentityProvider suffix and are stored in the externalAuthIdentityProviders directory. The type extends Metadata and inherits its fullName field.
In package.xml, use ExternalAuthIdentityProvider as the metadata type name. The type supports the wildcard member * for deployment and retrieval manifests.
The externalAuthIdentityProviderParameters entries are internal configuration structures exposed for packaging. Include them within the provider definition rather than treating ExternalAuthIdentityProviderParameter as a separate deployable asset.
For managed-package distribution, keep installation of the definition separate from credential provisioning. A reported per-user OAuth installation did not retain the provider's clientId and clientSecret. That scenario can require a separate provisioning step, but it does not establish that every installation behaves the same way. The reported provisioning approach and its limitations are described under Reported Issues.
When diagnosing hand-authored XML, pay attention to the collection element spelling. The documented field is plural, while the declarative example uses a singular spelling, as detailed below.
Relationships
The direct metadata relationship is from an external credential to this provider. Because the provider supplies token acquisition configuration, a change to its endpoints, flow, or request parameters can affect authentication for callouts using a referencing credential.
Referenced By
-
ExternalCredential:externalAuthIdentityProvider.
Documentation Inconsistencies
The documented collection field and exposed schema use externalAuthIdentityProviderParameters, but Salesforce's declarative XML example uses externalAuthIdentityProviderParameter. This discrepancy matters when diagnosing serialization or hand-authored XML. Do not silently substitute the sample's singular spelling for the schema's plural element name.
The exposed parameter enumeration also includes SfHttpRequestExtensionName, but the Metadata API parameter documentation does not list or behaviorally define that value. Its presence in an enumeration alone does not establish how to configure it.
Reported Issues
-
Client credentials were not retained after managed-package installation. In a February 2026 report involving per-user OAuth, the author found that the provider's
clientIdandclientSecretwere missing in subscriber installations. The author reported provisioning them through a setup-page button that calledConnectApi.NamedCredentials.createExternalAuthIdentityProviderCredentialsorConnectApi.NamedCredentials.updateExternalAuthIdentityProviderCredentials. Their attempt to run the code during post-installation failed for a reason they had not investigated. This is a reported workaround for that scenario, not a universal restriction on post-install Apex or a requirement to use a setup-page button. See the managed-package credential discussion.
Common Questions
How do I retrieve all ExternalAuthIdentityProvider components?
Use ExternalAuthIdentityProvider as the type name and * as the member in package.xml. Component files use the .externalAuthIdentityProvider suffix in the externalAuthIdentityProviders directory.
Which permission is required to access ExternalAuthIdentityProvider metadata?
A user needs either Customize Application or Manage Named Credentials. Having that permission does not establish successful authentication to the external system.
Does installing a managed package preserve the provider's client ID and client secret?
Do not assume it does. A February 2026 per-user OAuth report described missing clientId and clientSecret values after installation and separate provisioning through ConnectApi methods. That report does not establish universal behavior for all packages.
Is the XML parameter collection singular or plural?
The documented field and exposed schema use externalAuthIdentityProviderParameters. Salesforce's declarative example uses the singular externalAuthIdentityProviderParameter, creating a documentation discrepancy relevant to XML diagnosis.
Does sequenceNumber only control how parameters are displayed?
No. It controls the order in which parameters are applied. Lower numbers have higher priority, so 1 takes priority over 2.