---
schema_version: "1"
id: 9db87921a450b6551421ac665c058cc1075ed2cd21b03f36129d1ba97d4d4812
title: Package an External Client App That Isn't on a Dev Hub Org
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/xcloud/264-0-0/package_eca_not_on_dev_hub.md
canonical_url: https://help.salesforce.com/s/articleView?id=xcloud.package_eca_not_on_dev_hub.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 8aa717f26c35dff38667e6f14453fbd4c25323a34bdef703a74a976541dee0d7
description: 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.
products:
  - Security
  - Cross Cloud
release: "264"
---
# 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

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: Lightning Experience</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: <strong>Professional</strong>, <strong>Performance</strong>, <strong>Unlimited</strong>, and <strong>Developer</strong> Editions</td></tr></tbody></table>

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small permission">
        <colgroup>
          <col style="width:50%">
          <col style="width:50%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="colgroup" class="slds-cell-wrap" colspan="2" style="text-align:center;vertical-align:top;" id="d8482e74">User Permissions Needed</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d8482e74 ">To create an external client app</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d8482e74 ">Create, edit, and delete External Client Apps</td>

          </tr>
        </tbody>
      </table>

## Create an External Client App and Configure the Source Org

1. Create a packageable external client app.
    1. [Create an external client app](https://help.salesforce.com/s/articleView?id=xcloud.configure_packageable_external_client_apps.htm&release=264.0.0&type=5 "Determine whether to package and distribute your external client app or keep it local. Only packaged apps can be deployed to other orgs. You can package external client apps with first-generation or second-generation managed packages. Apps that use OAuth can be deployed with their own OAuth settings or they can reference settings on the org where the app was developed.")
    2. For Distribution State, select **Packaged**.
2. [Configure a namespace](https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/namespaces_creating.htm) for the org.
3. To authenticate the org, select a name for your org and run this command with Salesforce CLI.
    
    ```
    sf org login web -a <org name>
    ```
4. 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

1. Enable the Dev Hub org.
    
    1. From Setup, in the Quick Find box, enter Dev Hub and select **Dev Hub**.
    2. To enable Dev Hub, click **Enable**.
        
        After you enable Dev Hub, you can’t disable it.
    3. Enable **Unlocked Packages/Second-Generation Managed Packages**.
    
    See [Second-Generation Managed Packages](https://developer.salesforce.com/docs/atlas.en-us.pkg2_dev.meta/pkg2_dev/sfdx_dev_dev2gp.htm) and [Enable Dev Hub and Second-Generation Managed Packaging.](https://developer.salesforce.com/docs/atlas.en-us.pkg2_dev.meta/pkg2_dev/sfdx_pkg_enable_devhub.htm)
2. [Link the namespace from the org with your external client app in the Namespace Registry of the Dev Hub org.](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_reg_namespace.htm)
3. Authenticate the Dev Hub with Salesforce CLI.
    
    ```
    sf org login web --set-default-dev-hub
    ```

## Create a Second-Generation Managed Package

1. Update the project-scratch-def.json for the Salesforce DX project to allow external client app packaging from a different org. Add this setting.
    
    ```markup
    {
      "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.
2. Create the [package](https://developer.salesforce.com/docs/atlas.en-us.pkg2_dev.meta/pkg2_dev/sfdx_dev_dev2gp.htm).
    
    ```
    sf package create --name "testpkg" --package-type Managed --path "force-app"
    ```
3. Create the [package version](https://developer.salesforce.com/docs/atlas.en-us.pkg2_dev.meta/pkg2_dev/sfdx_dev_dev2gp.htm).
    
    ```
    sf package version create --package "testpkg" --installation-key test1234 -f config/project-scratch-def.json -w 15
    ```