Security Best Practices for Connected Apps and External Client Apps

Connected apps and external client apps (ECAs) control how integrations authenticate, get authorized, and access org data for users. Package and configure them securely to protect your customers’ orgs, and document your approach for security review.

When you submit an app for a security review, your documentation must cover:

  • How your solution architecture uses connected apps and ECAs.
  • Valid integration credentials for all associated web applications and REST APIs, so the review isn’t interrupted.
  • Technical details on how you protect and manage secrets across your backend infrastructure.

Starting in Spring ‘26, you can no longer create connected apps. For new integrations, use External Client Apps (ECAs). Existing connected apps remain supported, but plan to migrate them to External Client Apps.

Note

Security Best Practices 

Protect your application and customer data by enforcing these security guidelines across Visualforce, Lightning components, Apex callouts, and API integrations.

  • Apply the principle of least privilege by requesting only the OAuth scopes that your app requires to function. If your app requires the web or full scope, provide a detailed justification. When using the web scope, never extract session IDs from the frontdoor.jsp URL.

  • Keep callback URL configurations isolated across environment and client types. Create separate app entries for public and confidential clients, and never combine localhost callback URLs with external or production callback URLs in the same app definition.

    Never pair http://localhost:8080/callback with a live endpoint like https://app.example.com/oauth/callback in the same app definition.

    Note

  • Use OAuth tokens instead of session IDs to call the Metadata API from Apex. Obtain tokens by using the JSON Web Token (JWT) bearer flow. See Security Considerations for Session IDs and the sample implementations for Connected Apps and External Client Apps (ECAs).

  • Safeguard all app secrets, such as client keys, client secrets, certificates, encryption keys, and access or refresh tokens. Use secure locations to store them, and never expose them in app code or front-end pages. Also, make sure to refresh your credentials regularly. For more information, see OWASP: Secrets Management Cheat Sheet.

  • Enable and lock mandatory controls. See ISVforce secure code guidance.

Security Best Practices for Subscriber-Owned Apps 

When you build a local external client app (ECA) in the subscriber org, the key security controls are on by default. Also follow these practices.

  • Use only the approved OAuth flows: authorization code, client credentials, or JWT bearer.
  • Turn off risky flows, including device flow, username-password flow, and implicit flow.
  • Request only the access that your integration needs.
  • Protect every credential, including client keys and secrets, certificates, private and encryption keys, and access and refresh tokens.
  • Store secrets in the protected location that matches their owner.
    • Secrets that the subscriber owns: protected custom settings.
    • Secrets that you ship in your package (ISV): protected custom metadata types.

Packaging Best Practices for AppExchange Apps 

Package connected apps and External Client Apps (ECAs) for distribution through AppExchange in these scenarios:

  • Authorization code flow (web server flow): The callback URLs are managed by the independent software vendor (ISV) or developer.
  • Client credentials flow (server-to-server): The integration relies on the client ID and client secret of the ISV or developer.
  • JSON Web Token (JWT) bearer flow (server-to-server): The private key and certificate are owned by the ISV or developer. For example, generating OAuth tokens to call the Metadata API instead of relying on a session ID.
  • Canvas app integration: The solution incorporates a Canvas app.

If your architecture uses dynamic redirect URIs or specific domains, configure the app directly in the subscriber org. Document this use case so reviewers can verify its security during Security Review. To lock mandatory controls, see ISVforce Secure Coding Guidelines.