@salesforce/core 8.32.6-eca.0 → 8.32.6-eca.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/org/authInfo.js +20 -9
- package/lib/org/scratchOrgInfoApi.js +3 -1
- package/package.json +1 -1
package/lib/org/authInfo.js
CHANGED
|
@@ -725,17 +725,28 @@ class AuthInfo extends kit_1.AsyncOptionalCreatable {
|
|
|
725
725
|
}
|
|
726
726
|
else {
|
|
727
727
|
if (this.options.parentUsername) {
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
728
|
+
if (process.env.SF_SCRATCH_SIGNUP_CONNECTED_APP) {
|
|
729
|
+
// When the signup app is overridden, use it as the clientId for the auth code exchange.
|
|
730
|
+
// Skip loading parent fields entirely — we don't need the parent's privateKey/clientSecret
|
|
731
|
+
// and the parent org may not be in the StateAggregator cache.
|
|
732
|
+
options.clientId = process.env.SF_SCRATCH_SIGNUP_CONNECTED_APP;
|
|
733
|
+
if (process.env.SFDX_CLIENT_SECRET) {
|
|
734
|
+
options.clientSecret = process.env.SFDX_CLIENT_SECRET;
|
|
735
|
+
}
|
|
732
736
|
}
|
|
733
737
|
else {
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
}
|
|
738
|
+
const parentFields = await this.loadDecryptedAuthFromConfig(this.options.parentUsername);
|
|
739
|
+
options.clientId = parentFields.clientId;
|
|
740
|
+
if (process.env.SFDX_CLIENT_SECRET) {
|
|
741
|
+
options.clientSecret = process.env.SFDX_CLIENT_SECRET;
|
|
742
|
+
}
|
|
743
|
+
else {
|
|
744
|
+
// Grab whatever flow is defined
|
|
745
|
+
Object.assign(options, {
|
|
746
|
+
clientSecret: parentFields.clientSecret,
|
|
747
|
+
privateKey: parentFields.privateKey ? (0, node_path_1.resolve)(parentFields.privateKey) : parentFields.privateKey,
|
|
748
|
+
});
|
|
749
|
+
}
|
|
739
750
|
}
|
|
740
751
|
}
|
|
741
752
|
// jwt flow
|
|
@@ -60,11 +60,13 @@ const getOrgInstanceAuthority = function (scratchOrgInfoComplete, hubOrgLoginUrl
|
|
|
60
60
|
*/
|
|
61
61
|
const buildOAuth2Options = async (options) => {
|
|
62
62
|
const logger = await logger_1.Logger.child('buildOAuth2Options');
|
|
63
|
-
const
|
|
63
|
+
const signupAppOverridden = !!process.env.SF_SCRATCH_SIGNUP_CONNECTED_APP;
|
|
64
|
+
const isJwtFlow = !signupAppOverridden && !!options.hubOrg.getConnection().getAuthInfoFields().privateKey;
|
|
64
65
|
const oauth2Options = {
|
|
65
66
|
loginUrl: getOrgInstanceAuthority(options.scratchOrgInfoComplete, options.hubOrg.getField(org_1.Org.Fields.LOGIN_URL), options.signupTargetLoginUrl),
|
|
66
67
|
};
|
|
67
68
|
logger.debug(`isJwtFlow: ${isJwtFlow}`);
|
|
69
|
+
logger.debug(`signupAppOverridden: ${signupAppOverridden}`);
|
|
68
70
|
logger.debug(`using resolved loginUrl: ${oauth2Options.loginUrl ?? '<undefined>'}`);
|
|
69
71
|
if (isJwtFlow && !process.env.SFDX_CLIENT_SECRET) {
|
|
70
72
|
oauth2Options.privateKeyFile = options.hubOrg.getConnection().getAuthInfoFields().privateKey;
|