Repository navigation
Add --default-client to sign in with the built-in client - #838
Merged
Merged
Conversation
When a client or access key is configured, there was no way to sign in with the CLI's built-in public client short of passing its client ID by hand. --default-client (SFCC_DEFAULT_CLIENT) ignores any configured OAuth client, secret, or JWT, and forces browser sign-in, while keeping the rest of the configuration such as the server. Client flags on the command line conflict with it; values from env vars or config are overridden. OCAPI and SCAPI commands reject it because the built-in client has no API access.
Contributor
📘 Docs preview🧹 The preview for this PR has been removed (PR closed). |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a project configures an OAuth client or a WebDAV access key, there was no simple way to sign in with the CLI's built-in public client instead. You had to pass the built-in client's ID by hand, and that ID differs per Account Manager host. This matters when the configured client isn't set up for browser sign-in, or when you want to act with your own Business Manager permissions on an instance your project already configures.
--default-client(orSFCC_DEFAULT_CLIENT=true) makes a command behave as if no client were configured:user). Other settings such as the server still apply.--client-id,--client-secret,--jwt-cert,--jwt-key,--auth-methods, or theauth loginclient ID argument on the command line conflict with it and fail. The same values from env vars or config are overridden.auth login, WebDAV, code upload, logs, sandbox, and Account Manager commands. OCAPI and SCAPI commands fail with a clear error, because the built-in client has no API access.The flag is new and opt-in, so nothing changes without it.
Testing
Manual:
b2c auth login --default-client. It should sign in with the built-in client.b2c webdav ls --root temp --default-clientagainst that instance. It should use that sign-in, not the configured client or access key.b2c sites list --default-client. It should fail with the "no OCAPI or SCAPI access" error.b2c webdav ls --root temp --default-client --client-id x. It should be rejected as a conflict.