Package an External Client App That Isn't on a Dev Hub Org
To package an external client app that wasn't created on a Dev Hub org, use a namespace to connect the org to a Dev Hub org.
Required Editions
| Available in: Lightning Experience |
| Available in: Professional, Performance, Unlimited, and Developer Editions |
| User Permissions Needed | |
|---|---|
| To create an external client app | Create, edit, and delete External Client Apps |
Create an External Client App and Configure the Source Org
-
Create a packageable external client app.
- Create an external client app
- For Distribution State, select Packaged.
- Configure a namespace for the org.
-
To authenticate the org, choose a name for your org and run this command with Salesforce
CLI.
sf org login web -a <org name> -
Run this command to pull the metadata into your local Salesforce DX project.
sf project retrieve start --manifest package.xml -o <org name>
Configure the Dev Hub Org
-
Enable the Dev Hub org.
- From Setup, in the Quick Find box, enter Dev Hub and select Dev Hub.
-
To enable Dev Hub, click Enable.
After you enable Dev Hub, you can’t disable it.
- Enable Unlocked Packages/Second-Generation Managed Packages.
- Link the namespace from the org with your external client app in the Namespace Registry of the Dev Hub org.
-
Authenticate the Dev Hub with Salesforce CLI.
sf org login web --set-default-dev-hub
Create a Second-Generation Managed Package
-
Update the project-scratch-def.json for the Salesforce DX project to allow external client
app packaging from a different org. Add this setting.
{ "settings": { "externalClientAppSettings": { "enablePackageEcaOauthFromDevOrg": true } } }If you don't add this setting, you get a package version creation error. The error message says you can't create external client apps in ephemeral orgs.
-
Create the package.
sf package create --name "testpkg" --package-type Managed --path "force-app" -
Create the package version.
sf package version create --package "testpkg" --installation-key test1234 -f config/project-scratch-def.json -w 15
Did this article solve your issue?
Let us know so we can improve!

