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

W-16716321 clarify help for "org login sfdx-url" regarding force:// vs. https:// #1147

Merged
merged 2 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion messages/sfdxurl.store.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ Authorize an org using a Salesforce DX authorization URL stored in a file or thr

# description

The Salesforce DX (SFDX) authorization URL must have the format "%s". NOTE: The SFDX authorization URL uses the "force" protocol, and not "http" or "https". Also, the "instanceUrl" inside the SFDX authorization URL doesn't include the protocol ("https://").
You use the Salesforce DX (SFDX) authorization URL to authorize Salesforce CLI to connect to a target org. The URL contains the required data to accomplish the authorization, such as the client ID, client secret, and instance URL. You must specify the SFDX authorization URL in this format: "%s". Replace <clientId>, <clientSecret>, <refreshToken>, and <instanceUrl> with the values specific to your target org. For <instanceUrl>, don't include a protocol (such as "https://"). Note that although the SFDX authorization URL starts with "force://", it has nothing to do with the actual authorization. Salesforce CLI always communicates with your org using HTTPS.

To see an example of an SFDX authorization URL, run "org display --verbose" on an org.

You have three options when creating the authorization file. The easiest option is to redirect the output of the "<%= config.bin %> org display --verbose --json" command into a file. For example, using an org with alias my-org that you've already authorized:

Expand Down
4 changes: 2 additions & 2 deletions src/commands/org/login/sfdx-url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ export default class LoginSfdxUrl extends SfCommand<AuthFields> {

if (!sfdxAuthUrl) {
throw new Error(
`Error getting the auth URL from file ${authFile}. Please ensure it meets the description shown in the documentation for this command.`
`Error getting the SFDX authorization URL from file ${authFile}. Ensure it meets the description shown in the documentation (--help) for this command.`
);
}
} else if (authStdin) {
sfdxAuthUrl = authStdin;
} else {
throw new Error('SFDX Auth URL not found.');
throw new Error('SFDX authorization URL not found.');
}

const oauth2Options = AuthInfo.parseSfdxAuthUrl(sfdxAuthUrl);
Expand Down
2 changes: 1 addition & 1 deletion test/commands/org/login/login.sfdx-url.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ describe('org:login:sfdx-url', () => {
const response = await LoginSfdxUrl.run(['-f', keyPathJson, '--json']);
expect.fail(`Should have thrown an error. Response: ${JSON.stringify(response)}`);
} catch (e) {
expect((e as Error).message).to.includes('Error getting the auth URL from file');
expect((e as Error).message).to.includes('Error getting the SFDX authorization URL from file');
}
});

Expand Down
Loading