ExtlClntAppOauthConfigurablePolicies defines administrator-configured OAuth policies for an external client app. It controls who can authorize the app, authentication requirements, enabled authorization flows, execution users, and token lifetimes. The required externalClientApplication element names the associated ExternalClientApplication. This policy component is separate from the app definition and its ExtlClntAppOauthSettings configuration.
Key Elements
| Element | What the Element Controls |
|---|---|
externalClientApplication |
Required. Names the external client app associated with this policy component. |
permittedUsersPolicyType |
Selects AllSelfAuthorized or AdminApprovedPreAuthorized. |
commaSeparatedPermissionSet, commaSeparatedProfile
|
Comma-separated lists identifying the preauthorized population when permittedUsersPolicyType is AdminApprovedPreAuthorized. Either list or both can be used. Permission set entries are documented as IDs. |
ipRelaxationPolicyType |
Controls IP restrictions. Although exposed as a string, its documented values are Enforce, Bypass, Bypass_2factor, and Enforce_RelaxRefresh. |
policyAction, requiredSessionLevel
|
Control authentication security requirements together. Documented actions are Block and RaiseSessionLevel; session levels are HIGH_ASSURANCE, LOW, and STANDARD. See Documentation Inconsistencies for an additional exposed action. |
isClientCredentialsFlowEnabled, clientCredentialsFlowUser
|
Enable the OAuth 2.0 client credentials flow and identify the user on whose behalf Salesforce returns access tokens. The flag defaults to false; the execution user must have the API Only permission. |
isTokenExchangeFlowEnabled |
Enables the token exchange flow. Defaults to false. |
isGuestCodeCredFlowEnabled |
Enables the guest-user variation of the Authorization Code and Credentials Flow. Defaults to false. The app must also issue JSON Web Token (JWT) access tokens. |
apexHandler, executeHandlerAs
|
Name the Apex handler class and specify its execution user's username. This user is separate from the client credentials flow user. |
sessionTimeoutInMinutes |
Sets the session duration only for apps issuing opaque access tokens, rather than JWT access tokens. |
guestJwtSessionTimeoutType, guestJwtTimeout
|
Select UserSession or Custom for guest-user JWT expiration. Supply the timeout in minutes only with Custom; omit it with UserSession. |
namedUserJwtSessionTimeoutType, namedUserJwtTimeout
|
Select UserSession or Custom for named-user JWT expiration. Supply the timeout in minutes only with Custom; omit it with UserSession. |
refreshTokenPolicyType |
Controls refresh-token validity. Values are Infinite, SpecificInactivity, SpecificLifetime, and Zero. |
refreshTokenValidityPeriod, refreshTokenValidityUnit
|
Specify the validity interval for SpecificInactivity or SpecificLifetime. The period is an integer; documented units are Days, Hours, and Months. |
customAttributes |
Contains up to 128 administrator-defined default attributes. Each entry requires a unique key and a formula identifying an existing available field. |
Behavior and Constraints
Administrative access. Administrators need the "View all External Client Apps, view their settings, and edit their policies" user permission to configure OAuth policies.
User authorization and authentication. With AdminApprovedPreAuthorized, commaSeparatedPermissionSet, commaSeparatedProfile, or both identify the preauthorized users. Both elements use comma-separated serialization. For the documented two-factor identity-verification behavior, use RaiseSessionLevel together with requiredSessionLevel; the action and required security level must be interpreted together.
Flow prerequisites and execution users. Enabling isGuestCodeCredFlowEnabled does not by itself make the guest flow usable: the app must also be configured to issue JWT-based access tokens. For the client credentials flow, clientCredentialsFlowUser identifies the user represented by the returned access tokens and requires the API Only permission. By contrast, executeHandlerAs is the username under which the Apex handler runs. These elements describe different execution contexts.
Access-token timeouts. The app's token format determines which timeout settings apply. sessionTimeoutInMinutes applies only to opaque tokens. Guest and named-user JWT tokens use their respective JWT timeout selectors and timeout elements.
- With
UserSession, Salesforce usessessionTimeoutfromProfileSessionSetting. For guest tokens, this is the Experience Cloud guest user profile; for named-user tokens, it is the named user's profile. - If the applicable profile has no session timeout, Salesforce uses
sessionTimeoutfromSessionSettings. When both settings exist, the profile setting takes precedence. Omit the correspondingguestJwtTimeoutornamedUserJwtTimeoutelement. - With
Custom, use the corresponding timeout element. Allowed values, in minutes, are1,5,10,15,30,60,90,120,240,480, and720.
A JWT policy using UserSession cannot be interpreted from this component alone. Its effective timeout also depends on the applicable profile session setting or org session setting.
Refresh tokens. Refresh-token validity is separate from opaque-session duration and JWT access-token expiration. For SpecificInactivity or SpecificLifetime, refreshTokenValidityPeriod and refreshTokenValidityUnit specify the interval.
Customization and navigation. commaSeparatedCustomScopes contains custom scope names separated by commas. Each entry in customAttributes is a contained ExtlClntAppOauthPoliciesAttribute definition, not an independently deployable component. Its required key must be unique, and its required formula identifies an existing available field, such as Organization.Country. These attributes provide administrator-defined defaults that can supply personal information to customize the app.
startUrl directs users after authentication. singleLogoutUrl is the destination to which Salesforce sends a logout request when users log out of Salesforce; it does not guarantee that the remote application terminates its session.
Deployment and Retrieval
Components use the .ecaOauthPlcy suffix and reside in the extlClntAppOauthPolicies folder. The type inherits fullName from Metadata. The required externalClientApplication element identifies the associated app rather than replacing the policy component's own metadata identity.
In package.xml, use the type name ExtlClntAppOauthConfigurablePolicies. The type supports the wildcard member *.
Metadata API deployment and managed-package installation are separate support questions. The reported second-generation managed-package restriction below concerns installation and upgrade; it does not establish a restriction on ordinary Metadata API deployment. Likewise, a report that a policy appeared in a subscriber org does not prove that this metadata component itself is installable in a managed package.
When moving a preauthorization policy between orgs, the distinction between a permission set record ID and a developer name matters. The name-like value in Salesforce's example does not establish that these identifiers are interchangeable.
Relationships
The policy connects directly to its external client app and, when configured, an Apex handler. Its effective JWT timeout can also depend on ProfileSessionSetting and SessionSettings; those are settings dependencies, not direct component-reference elements in this type.
References
-
ApexClass:apexHandler, by class name. -
ExternalClientApplication:externalClientApplication, by app name.
Documentation Inconsistencies
-
Permission set IDs versus the example. The field description defines
commaSeparatedPermissionSetas a list of permission set IDs, but the example supplies the name-like valuePermSetExample. The example does not establish support for substituting developer names for record IDs. -
Additional authentication action. The type documentation lists
BlockandRaiseSessionLevelforpolicyAction. The exposed enumeration also includesStepUpMFA, but the type documentation does not define its behavior. -
Mismatched XML in the sample. The sample opens
namedUserJwtTimeoutbut closesnamedUserJwtSessionTimeout. The closing tag must matchnamedUserJwtTimeoutfor the XML to be well formed.
Reported Issues
-
A second-generation managed package can be rejected during installation or upgrade when it includes this component. A March-April 2026 discussion reports rejection of packages containing
ExtlClntAppOauthConfigurablePolicies. The accepted answer relays Salesforce Support's position that these environment-specific policies must be configured directly in the subscriber org and links a Known Issue. This is a reported packaging limitation, not a report about ordinary Metadata API deployment. See the package installation discussion and the linked Known Issue. - A propagation report does not guarantee the policy applied by a particular installation. A December 2024 unaccepted answer claimed that configuring admin-approved preauthorization in the development org caused the policy to appear in the subscriber org. That report does not establish that this policy metadata type itself can be installed in a managed package. See the policy propagation answer.
-
Preauthorization assignments can fail when the selected permission set is managed or namespaced. A December 2025-February 2026 discussion reports an external client app save failure referring to
SetupEntityAccessandMANAGED_INSTALLED. An answer reports that local permission sets worked. Managed permission-set state is therefore relevant to diagnosing this reported failure, but the discussion does not establish a universal prohibition. See the managed permission set discussion.
Common Questions
Can I include ExtlClntAppOauthConfigurablePolicies in a managed package?
A 2026 report describes second-generation managed-package installation and upgrade rejection when this component is included. The accepted answer relays Salesforce Support's direction to configure these environment-specific policies in the subscriber org. Do not treat Metadata API manifest support as proof of package installability.
Does commaSeparatedPermissionSet accept permission set names or IDs?
The field is documented as accepting comma-separated permission set IDs. Salesforce's example uses a name-like value, but that inconsistency does not establish that developer names and record IDs are interchangeable.
Why does sessionTimeoutInMinutes not control my JWT access-token lifetime?
It applies only to opaque tokens. JWT access tokens use the guest or named-user JWT timeout settings. With UserSession, the applicable profile timeout takes precedence over the org timeout; with Custom, the corresponding JWT timeout element supplies the duration.
Are executeHandlerAs and clientCredentialsFlowUser the same execution user?
They describe separate execution contexts. executeHandlerAs is the Apex handler execution user's username. clientCredentialsFlowUser identifies the user on whose behalf Salesforce returns client credentials access tokens, and that user must have the API Only permission.
Is enabling isGuestCodeCredFlowEnabled enough to use the guest flow?
No. The app must also be configured to issue JWT-based access tokens. The flag enables the guest-user variation of the Authorization Code and Credentials Flow, but does not satisfy that token-format prerequisite.