The SFDX Auth URL is the credential format that enables automated Salesforce authentication. Understanding how it works helps you configure orgs correctly and troubleshoot authentication issues.
What is an SFDX Auth URL?
An SFDX Auth URL is a URL-formatted credential containing OAuth2 tokens that allow non-interactive authentication with Salesforce. It's the standard credential format used by Salesforce CLI and sfp for automation.
sfp-server provides centralized, secure storage for SFDX Auth URLs. When you register orgs with the server, credentials are encrypted and stored in Supabase, then decrypted on-demand when needed.
Credential Storage Architecture
Database Schema
sfp-server stores credentials in the sfp_salesforce_auth table:
Column
Description
username
Salesforce username
instance_url
Salesforce instance URL
org_id
Salesforce Org ID
org_type
production, sandbox, or devhub
sfdx_auth_url_encrypted
Encrypted SFDX Auth URL
is_devhub
Whether org is a DevHub
is_default
Default org for its type
parent_production_username
Parent org (for JIT sandboxes)
is_jit_registration
Whether sandbox uses JIT auth
Encryption
SFDX Auth URLs are encrypted using PGP symmetric encryption before storage:
The encryption key is configured during sfp-server setup and never leaves the server.
Registering Orgs with sfp-server
Production Orgs and DevHubs
Production orgs and DevHubs require an SFDX Auth URL during registration:
What happens during registration:
CLI extracts the sfdxAuthUrl from local authentication
Validates the connection by querying the org
Sends to sfp-server which encrypts and stores it
Sandboxes (Two Options)
Option 1: Direct Registration (with SFDX Auth URL)
Option 2: JIT Registration (recommended)
JIT (Just-In-Time) sandboxes don't store credentials - they generate them on-demand via the parent production org:
sfp-server always returns short-lived access tokens when you access environments. The full SFDX Auth URL (containing the refresh token) never leaves the server.
Access Token Generation
When you request credentials:
Server retrieves stored sfdxAuthUrl (encrypted)
Uses refresh token to generate new access token
Returns only the short-lived access token (~2 hours)
Refresh token stays on the server
Exception: Scratch Orgs and Pool-Fetched Sandboxes
For scratch orgs fetched from pools and certain sandbox pool scenarios, the full SFDX Auth URL is returned. This is necessary because:
Scratch org operations may require extended sessions
Pool-fetched environments need independent credential lifecycle
The orgs have limited lifespan anyway (scratch orgs expire)
These are the only scenarios where sfdxAuthUrl leaves the server.
Community Edition: Direct SFDX Auth URL Usage
Without sfp-server, you manage SFDX Auth URLs directly in CI/CD secrets.
Generating an SFDX Auth URL
Using in CI/CD
Store the SFDX Auth URL as a secret (e.g., PRODUCTION_AUTH_URL), then:
# Step 1: Authenticate locally
sf org login web --alias production
# Step 2: Register with sfp-server
sfp server org register --targetorg production
# For DevHub
sf org login web --alias devhub
sfp server org register --targetorg devhub --is-devhub --is-default
# Authenticate to sandbox directly
sf org login web --alias uat --instance-url https://test.salesforce.com
# Register with sfp-server
sfp server org register --targetorg uat
# Register sandbox by name (no local auth needed)
sfp server org register-sandbox \
--sandbox-name uat \
--production-username [email protected]