ensureScratchOrgSession
ensureScratchOrgSession(
authFields,options):Promise<void>
Defined in: packages/simply-cicd-core/src/build/scratchOrgAuth.ts:38
Ensures the scratch org recorded in SCRATCH_ORG_INFO.json has a live session, using whichever
renewable credential it actually has.
A scratch org whose Dev Hub authenticated via web/SFDX auth-url gets its own refreshToken at
creation time (Salesforce’s OAuth “web server” flow always returns one) — that’s used directly
via @salesforce/core, no shell-out. A JWT-authenticated Dev Hub never produces a refresh token
(JWT bearer grants don’t have one), so that case still falls back to the existing
authenticateOrg() JWT re-auth.
Parameters
Section titled “Parameters”authFields
Section titled “authFields”clientId
Section titled “clientId”string
clientSecret?
Section titled “clientSecret?”string
Present alongside refreshToken for a custom connected app.
devHubUsername?
Section titled “devHubUsername?”string
instanceUrl
Section titled “instanceUrl”string
refreshToken?
Section titled “refreshToken?”string
Present when the owning Dev Hub wasn’t JWT-authenticated.
username
Section titled “username”string
options
Section titled “options”EnsureScratchOrgSessionOptions
Returns
Section titled “Returns”Promise<void>