Sub topic 3
ECA Settings, Policies, and Migration
Assume you know Salesforce Setup, OAuth, REST APIs, and basic curl. An external client app (ECA) has two distinct parts:
- Settings define what the app is. They include OAuth client details, callback URLs, scopes, and authentication methods.
- Policies define how the app may be used in an org. They include permitted users, IP relaxation, session behavior, and refresh-token rules.
Keeping these concerns separate lets developers distribute an app while administrators control access locally.
| Area | Main question | Typical owner |
|---|---|---|
| ECA settings | What can this app request? | Developer |
| ECA policies | Who can use it, and under what conditions? | Administrator |
Local and Packaged Distribution
A local ECA exists only in the org where it was created. Use it for an internal integration or org-specific prototype. A packaged ECA can be delivered with a managed package, which helps an ISV distribute consistent application settings while each subscriber controls local policies.
Packaging does not remove the subscriber’s responsibility to review scopes, users, and session settings.
Metadata and Source-Driven Deployment
ECA metadata can be stored in a Salesforce DX project and deployed through version control and CI. Keep environment-specific values, such as callback domains and secrets, out of source control. Retrieve and deploy metadata with the Salesforce CLI, then apply org-specific policies separately.
sf project deploy start \
--metadata ExternalClientApplication:MyIntegrationMigrating from Connected Apps
Inventory each connected app’s flows, scopes, callback URLs, policies, and consuming systems. Create an equivalent ECA, test it in a sandbox, and update clients to use the new client identity. Do not assume existing refresh tokens or sessions transfer. Plan a coordinated token renewal and rollback window.
Security, Monitoring, and Troubleshooting
Request only required scopes. Prefer authorization code with PKCE for interactive clients and JWT bearer authentication for controlled server-to-server jobs. Protect private keys and secrets, use short token lifetimes where possible, and restrict permitted users.
Review OAuth usage, login history, connected sessions, and API event monitoring for unexpected clients or failures. Revoke suspicious sessions and rotate credentials.
Common errors usually indicate a mismatched callback URL, missing scope, blocked user, invalid audience, expired JWT, or incorrect policy. Compare the request with the ECA settings and inspect the OAuth error response.
Exercise
An integration receives invalid_grant after migrating to an ECA. What should you check first?
Show answer
Check the callback URL, grant type, client identity, token lifetime, and whether the ECA policy permits the integration user.