Sub topic 13
ECA Settings Versus Policies
This chapter assumes you know how a connected app is configured (consumer key, callback URL, scopes, policies) and the basics of OAuth flows in Salesforce. It explains how an external client app (ECA) splits that configuration into two parts, and why the split matters.
Why the split exists
A connected app mixes two kinds of information in one record. Some of it describes the software: its callback URL, its scopes, whether it uses PKCE. The rest describes how a particular org wants to control it: which users may use it, which IP ranges are allowed, how long a refresh token lives.
When a developer packages a connected app for other orgs, both kinds travel together. The admin of the installing org can change the policy values afterward. But the structure doesn't make clear who owns which value.
An ECA separates the two:
- Settings are the developer's definition of the app. They are the same everywhere the app is installed.
- Policies are the subscriber admin's rules for the app. They belong to the org where the app runs.
What belongs where
| Area | Settings (developer) | Policies (admin) |
|---|---|---|
| App identity | Name, contact email, description, logo | Not applicable |
| OAuth | Callback URLs, scopes, flows enabled, PKCE requirement, consumer key and secret | Permitted users, which profiles and permission sets may use the app |
| Tokens | Which token behaviors the app supports | Refresh token policy, session timeout, token validity |
| Network | Not applicable | IP relaxation, login IP ranges |
| Flow-specific | JWT bearer certificate, client credentials enablement | Run-as user for client credentials |
The exact fields can change between releases, so check the Setup pages in your org. The principle stays the same. If a value describes what the app needs in order to work, it is a setting. If it describes who may use the app and under what conditions, it is a policy.
Where you find each in Setup
In Setup, search for External Client App Manager. Each ECA has a detail page with these sections:
- Settings. Contains the OAuth settings, such as callback URL and scopes, plus the flow-enablement options.
- Policies. Contains the OAuth policies, such as permitted users, IP relaxation, and refresh token behavior.
An admin who only manages policies does not need to see or edit settings. This lets you give a developer rights to define apps without also letting them decide which users may use those apps in production.
Who can edit what
Settings and policies can be handled by different people through permissions. A developer creates and edits the ECA's settings. An admin in the org where the app runs sets the policies. For a locally developed ECA both roles may be the same person, but the separation remains in the data model.
For an ECA installed from a package, the picture is stricter:
- The subscriber admin cannot change the developer's settings. This protects the integrity of the app: nobody can add a scope or a callback URL to an installed app.
- The subscriber admin can edit policies. Each subscriber org decides its own access rules.
This is a key difference from a packaged connected app, where the subscriber could alter more of the configuration.
How the split affects a request
Settings and policies are evaluated at different points. The diagram shows the order when an app asks for a token.
A request can fail for two different reasons, and the fix lives in a different place:
- A redirect URI mismatch or an unapproved scope points to settings. A developer must change the app definition.
- A user who is not allowed, or a login from a blocked IP address, points to policies. An admin must change the org's rules.
Knowing which category an error belongs to saves time when troubleshooting.
Example: client credentials flow
The client credentials flow shows the split clearly. The request itself is the same as for a connected app:
curl -X POST https://MyDomain.my.salesforce.com/services/oauth2/token \
-d grant_type=client_credentials \
-d client_id="$CONSUMER_KEY" \
-d client_secret="$CONSUMER_SECRET"For this call to work, two things must be true:
- In settings, the client credentials flow is enabled for the app.
- In policies, a run-as user is chosen. The token carries that user's permissions.
If step 1 is missing, the request fails because the app does not support the flow. If step 2 is missing, the app supports the flow, but the org has not said who it runs as. Different errors, different owners.
You can verify the resulting token with the REST API versions resource:
curl https://MyDomain.my.salesforce.com/services/data/ \
-H "Authorization: Bearer $ACCESS_TOKEN"Common errors and gotchas
- Editing policies in the wrong place. Admins who are used to connected apps look for "Manage" and "Edit Policies" links. In ECAs these are in the policies section of the ECA detail page.
- Assuming a policy travels with the package. A packaged ECA brings its settings. Each subscriber org configures its own policies, so a freshly installed app usually has no one permitted to use it until an admin acts.
- Treating the consumer secret as a policy. The consumer key and secret belong to the app's settings side. Rotating them is a developer-side task.
- Fixing a scope problem in policies. Policies can restrict who gets access, but they cannot add scopes the settings do not allow.
- Granting too much to speed up testing. A broad permitted-users rule or relaxed IP policy can end up in production. Review policies after every install or update.
Design guidance
Keep the settings minimal. Include only the scopes and flows the app uses, because every extra one is visible to every org that installs it. Put everything org-specific in policies. Then, whenever you need to answer "who can use this app, and from where?", you have a single place to look.
Exercise
A packaged ECA installed in your org returns an error because the callback URL sent by the app does not match any registered URL. Separately, a user in your org is blocked from authorizing it because their profile is not permitted. For each problem, say whether it is a settings or a policies issue, and who can fix it in your org.
Show answer
The callback URL mismatch is a settings issue. Settings belong to the developer and a subscriber admin cannot edit them in a packaged ECA, so the developer must update the app and release a new version. The blocked profile is a policies issue. Your org's admin can fix it by editing the ECA's policies to permit that profile or a permission set that includes the user.
Exercise
Why does the client credentials flow need configuration in both the settings and the policies of an ECA?
Show answer
The settings enable the flow, so the app is allowed to use it. The policies name the run-as user, so the org decides whose permissions the issued token carries. Without the first, the app cannot request the flow. Without the second, there is no user for the token to run as.