PluginBench
Skill
Review
Audit score 70

sf-connected-apps

jaganpro/sf-skills

Salesforce OAuth and Connected Apps configuration with security hardening and ECA/legacy support.

What is sf-connected-apps?

Manages Salesforce Connected Apps and External Client Apps (ECAs) with OAuth flow selection, JWT bearer auth, PKCE, and scope design. Use this when configuring OAuth flows, handling .connectedApp-meta.xml or .eca-meta.xml files, or migrating between Connected App and ECA patterns.

  • Choose between Connected App and External Client App (ECA) architecture based on distribution and security needs
  • Select and configure OAuth flows: Authorization Code, PKCE, JWT Bearer, Device Flow, or Client Credentials
  • Apply security hardening: least-privilege scopes, explicit callback URLs, PKCE for public clients, certificate-based auth
  • Manage metadata files across ECA directories (externalClientApps, extlClntAppOauthSettings, extlClntAppOauthSecuritySettings, extlClntAppOauthPolicies)
  • Validate deployment readiness and prevent anti-patterns like wildcard callbacks, overly broad scopes, or exposed secrets
  • Integrate with Named Credentials, Apex token handling, and permission policies via cross-skill delegation

How to install sf-connected-apps

npx skills add https://github.com/jaganpro/sf-skills --skill sf-connected-apps
Prerequisites
  • Salesforce CLI (sf) installed and authenticated to target org
  • Understanding of OAuth 2.0 flows and your app's client type (confidential vs. public)
  • Access to org metadata retrieval if working with existing ECA OAuth security settings
Claude Code
Cursor
Windsurf
Cline

How to use sf-connected-apps

  1. 1.Gather required context: app type (Connected App or ECA), OAuth flow, client type, callback URLs, required scopes, and distribution model
  2. 2.Decide app model: choose ECA for new regulated/packageable solutions; Connected App for legacy compatibility
  3. 3.Select OAuth flow based on use case (Authorization Code, PKCE, JWT Bearer, Device Flow, or Client Credentials)
  4. 4.Use provided asset templates (connected-app-basic.xml, external-client-app.xml, eca-oauth-settings.xml, etc.) instead of building from scratch
  5. 5.Apply security hardening: narrow scopes to least-privilege, constrain callback URLs, enable PKCE for public clients, keep secrets outside version control
  6. 6.Validate metadata file naming and directory structure (note: .ecaGlblOauth, .ecaPlcy, .ecaOauthSecurity suffixes)
  7. 7.Confirm deployment readiness: scopes justified, callbacks match client type, secrets not embedded, rotation strategy in place

Use cases

Good for
  • Backend web app needs Authorization Code flow with callback URL and scope configuration
  • SPA or mobile app requires PKCE-protected Authorization Code flow for public clients
  • CI/CD automation or server-to-server integration needs JWT Bearer auth with certificate management
  • Migrating legacy Connected Apps to newer External Client App pattern for better secret handling and multi-org support
  • Device or CLI authentication flow setup for user-friendly authorization without embedded credentials
Who it's for
  • Salesforce integration architects designing OAuth app models
  • DevOps and CI/CD engineers setting up service-account-style automation
  • Security-focused developers hardening Connected App and ECA configurations
  • Teams migrating from Connected Apps to External Client Apps for regulated or packageable solutions

sf-connected-apps FAQ

When should I use External Client App (ECA) instead of Connected App?

Prefer ECA for new development, regulated environments, multi-org/packaging scenarios, and when better secret handling is required. Use Connected App for legacy compatibility or simple single-org OAuth. Note: Spring '26 disables new Connected App creation by default; use ECA unless explicitly required.

What OAuth flow should I choose for a public client like a SPA or mobile app?

Use Authorization Code + PKCE. PKCE protects against code interception attacks and is essential for public clients that cannot securely store a client secret.

How do I handle secrets and certificates securely?

Never commit consumer secrets or certificates to source control. Use JWT certificates for server-to-server auth where possible, implement rotation-ready secret handling, and store credentials in secure vaults outside version control.

What are the key ECA metadata directories and file suffixes?

ECA uses multiple directories: externalClientApps (.eca-meta.xml), extlClntAppOauthSettings (.ecaOauth-meta.xml), extlClntAppOauthSecuritySettings (.ecaOauthSecurity-meta.xml), extlClntAppOauthPolicies (.ecaOauthPlcy-meta.xml), and extlClntAppPolicies (.ecaPlcy-meta.xml). Note the exact suffixes: .ecaGlblOauth (not GlobalOauth) and .ecaPlcy (not Policy).

What should I do before deploying a Connected App or ECA?

Validate that metadata file naming is correct, scopes are justified and least-privilege, callback URLs are explicit (not wildcards), auth model matches your client type, secrets are not embedded, and you have a rotation/cert strategy for long-term operations.

Full instructions (SKILL.md)

Source of truth, from jaganpro/sf-skills.


name: sf-connected-apps description: > Salesforce Connected Apps and OAuth configuration with 120-point scoring. TRIGGER when: user configures OAuth flows, JWT bearer auth, Connected Apps, or touches .connectedApp-meta.xml / .eca-meta.xml files. DO NOT TRIGGER when: Named Credentials for callouts (use sf-integration), permission policies (use sf-permissions), or API endpoint code (use sf-apex). license: MIT allowed-tools: Bash Read Write Edit Glob Grep WebFetch AskUserQuestion TodoWrite metadata: version: "1.1.0" author: "Jag Valaiyapathy" scoring: "120 points across 6 categories"

sf-connected-apps: Salesforce Connected Apps & External Client Apps

Use this skill when the user needs OAuth app configuration in Salesforce: Connected Apps, External Client Apps (ECAs), JWT bearer setup, PKCE decisions, scope design, or migration from older Connected App patterns to newer ECA patterns.

When This Skill Owns the Task

Use sf-connected-apps when the work involves:

  • .connectedApp-meta.xml or .eca-meta.xml files
  • OAuth flow selection and callback / scope setup
  • JWT bearer auth, device flow, client credentials, or auth-code decisions
  • Connected App vs External Client App architecture choices
  • consumer-key / secret / certificate handling strategy

Delegate elsewhere when the user is:

  • configuring Named Credentials or runtime callouts → sf-integration
  • analyzing access / permission policy assignments → sf-permissions
  • writing Apex token-handling code → sf-apex
  • deploying metadata to orgs → sf-deploy

First Decision: Connected App or External Client App

If the need is...Prefer
simple single-org OAuth appConnected App
new development with better secret handlingExternal Client App
multi-org / packaging / stronger operational controlsExternal Client App
straightforward legacy compatibilityConnected App

Default guidance:

  • choose ECA for new regulated, packageable, or automation-heavy solutions
  • choose Connected App when simplicity and legacy compatibility matter more
  • Spring ’26 note: creation of new Connected Apps is disabled by default in orgs. For new integrations, prefer External Client Apps unless Connected App compatibility is explicitly required.

Required Context to Gather First

Ask for or infer:

  • app type: Connected App or ECA
  • OAuth flow: auth code, PKCE, JWT bearer, device, client credentials
  • client type: confidential vs public
  • callback URLs / redirect surfaces
  • required scopes
  • distribution model: local org only vs packageable / multi-org
  • whether certificates or secret rotation are required

Recommended Workflow

1. Choose the app model

Decide whether a Connected App or ECA is the better long-term fit.

2. Choose the OAuth flow

Use caseDefault flow
backend web appAuthorization Code
SPA / mobile / public clientAuthorization Code + PKCE
server-to-server / CI/CDJWT Bearer
device / CLI authDevice Flow
service account style appClient Credentials (typically ECA)

3. Start from the right template

Use the provided assets instead of building from scratch:

  • assets/connected-app-basic.xml
  • assets/connected-app-oauth.xml
  • assets/connected-app-jwt.xml
  • assets/external-client-app.xml
  • assets/eca-global-oauth.xml
  • assets/eca-oauth-settings.xml
  • assets/eca-policies.xml

If you need source-controlled ECA OAuth security metadata, retrieve it from an org first and treat the retrieved file as the schema source of truth:

  • sf project retrieve start --metadata ExtlClntAppOauthSecuritySettings:<AppName> --target-org <alias>

4. Apply security hardening

Favor:

  • least-privilege scopes
  • explicit callback URLs
  • PKCE for public clients
  • certificate-based auth where appropriate
  • rotation-ready secret / key handling
  • IP restrictions when realistic and maintainable

5. Validate deployment readiness

Before handoff, confirm:

  • metadata file naming is correct
  • scopes are justified
  • callback and auth model match the real client type
  • secrets are not embedded in source

High-Signal Security Rules

Avoid these anti-patterns:

Anti-patternWhy it fails
wildcard / overly broad callback URLstoken interception risk
Full scope by defaultunnecessary privilege
PKCE disabled for public clientscode interception risk
consumer secret committed to sourcecredential exposure
no rotation / cert strategy for automationbrittle long-term ops

Default fix direction:

  • narrow scopes
  • constrain callbacks
  • enable PKCE for public clients
  • keep secrets outside version control
  • use JWT certificates or controlled secret storage where appropriate

Metadata Notes That Matter

Connected App

Usually lives under:

  • force-app/main/default/connectedApps/

External Client App

Current source-supported ECA metadata uses multiple top-level source directories, not a single externalClientApps/ folder:

  • force-app/main/default/externalClientApps/ → ExternalClientApplication (.eca-meta.xml)
  • force-app/main/default/extlClntAppGlobalOauthSets/ → ExtlClntAppGlobalOauthSettings (.ecaGlblOauth-meta.xml)
  • force-app/main/default/extlClntAppOauthSettings/ → ExtlClntAppOauthSettings (.ecaOauth-meta.xml)
  • force-app/main/default/extlClntAppOauthSecuritySettings/ → ExtlClntAppOauthSecuritySettings (.ecaOauthSecurity-meta.xml)
  • force-app/main/default/extlClntAppOauthPolicies/ → ExtlClntAppOauthConfigurablePolicies (.ecaOauthPlcy-meta.xml)
  • force-app/main/default/extlClntAppPolicies/ → ExtlClntAppConfigurablePolicies (.ecaPlcy-meta.xml)

Important file-name gotchas:

  • the global OAuth suffix is .ecaGlblOauth, not .ecaGlobalOauth
  • the general policy suffix is .ecaPlcy, not .ecaPolicy
  • use .ecaOauthSecurity for ExtlClntAppOauthSecuritySettings

Output Format

When finishing, report in this order:

  1. App type chosen
  2. OAuth flow chosen
  3. Files created or updated
  4. Security decisions
  5. Next deployment / testing step

Suggested shape:

App: <name>
Type: Connected App | External Client App
Flow: <oauth flow>
Files: <paths>
Security: <scopes, PKCE, certs, secrets, IP policy>
Next step: <deploy, retrieve consumer key, or test auth flow>

Cross-Skill Integration

NeedDelegate toReason
Named Credential / callout runtime configsf-integrationruntime integration setup
deploy app metadatasf-deployorg validation and deployment
Apex token or refresh handlingsf-apeximplementation logic
permission review after deploymentsf-permissionsaccess governance

Reference Map

Start here

Migration / examples


Score Guide

ScoreMeaning
80+production-ready OAuth app config
54–79workable but needs hardening review
< 54block deployment until fixed