Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improved scratch org create authentication #1147

Merged
merged 1 commit into from
Oct 8, 2024

Conversation

shetzel
Copy link
Contributor

@shetzel shetzel commented Oct 3, 2024

What does this PR do?

  1. The signupTargetLoginUrl override used in sfdx-project.json files was not used for scratchOrgResumes, causing auth code exchange issues during resume. It is now used.
  2. encrypts the client secret written to the scratch-create-cache.json file.
  3. If the auth code exchange fails when using a loginUrl that differs from ScratchOrgInfo.LoginUrl another attempt is made using ScratchOrgInfo.LoginUrl.
  4. Improves debug logging for the loginUrl used during the auth code exchange

What issues does this PR fix or reference?

@W-16825003@

To QA:

  • use a devhub with another connected app that has a consumer secret and use it to create scratch orgs. Ensure the clientSecret value written to the cache file is encrypted.
  • resume a scratch org create where the signupTargetLoginUrl is necessary and ensure that login URL override is used for the auth code exchange.
  • check that another attempt is made if the auth code exchange fails with the first loginUrl if that loginUrl doesn't match ScratchOrgInfo.LoginUrl.

@shetzel shetzel requested a review from a team as a code owner October 3, 2024 21:21
loginUrl: `https://${TEMPLATE_SCRATCH_ORG_INFO.SignupInstance}.salesforce.com`,
privateKeyFile: privateKey,
},
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None of the existing tests could possibly fail since result is a stubbed return setup by the tests. I added expectations that should have been there from the start, as well as a few additional checks for the new code I added.

@mdonnalley mdonnalley merged commit 8d8360b into main Oct 8, 2024
73 checks passed
@mdonnalley mdonnalley deleted the sh/scratch-org-creation-fixes branch October 8, 2024 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants