Skip to content

Managing Secrets

David B edited this page Dec 18, 2025 · 8 revisions

GitHub securely authenticates to Salesforce using OAuth tokens.

These are typically stored in GitHub under Org Settings > Secrets or Repository Settings > Secrets.

The following secrets are critical for successful testing and delivery of a Salesforce package:

Secret Name Alternative Name Purpose
DEV_HUB_AUTH_URL sfdxAuthUrl Enables the creation of scratch orgs during CI/CD operations
CUMULUSCI_TOKEN GitHub PAT Enables execution of remote GitHub actions (e.g. nimba-actions/standard-workflows)

Should you ever need to update stored OAuth tokens or create additional secrets, you will need to generate an sfdxAuthUrl using the Salesforce/CLI.

Obtain an DEV_HUB_AUTH_URL

Important

You must complete the following prerequisites before proceeding

  1. Enable Dev Hub and Second-Generation Managed Packaging
  2. Install the latest version of Salesforce/CLI
  1. Authenticate to Salesforce using salesforce/cli:
    • Open your terminal or command prompt.
    • Use the Salesforce CLI to log in to your Salesforce org by running the following command:
      # replace `<your-org-alias>` with any value you desire eg "MyDevhub"...
      sf org login web --alias <your-org-alias>
    • This command will open a browser window where you can log in to Salesforce. After logging in, your org will be authenticated with the Salesforce CLI.
  1. Install the latest version of Salesforce/CLI
  1. Generate the Auth URL:

    • After logging in, generate the sfdxAuthUrl by running:
      # replace `<your-org-alias>` with the same alias you used in the previous step...
      sf org display -o <your-org-alias> --verbose --json > orgInfo.json
    • The command will display the details of the authenticated org, including the sfdxAuthUrl.
  2. Copy the Auth URL:

    • Look for the line that starts with SFDX Auth Url and copy the URL provided. It will look something like this:
      force://<client_id>:<client_secret>@<instance_url>/<refresh_token>
      
  3. Use the Auth URL:

    • Paste this sfdxAuthUrl value into your desired Repository Secret.
    • Save.

Important Notes:

  • Security: Handle the sfdxAuthUrl securely, as it contains sensitive information that can provide access to your Salesforce org.
  • Token Expiration: Be aware that the refresh token included in the URL might have an expiration policy, depending on your Salesforce org settings.

Clone this wiki locally