Skip to content

Commit

Permalink
Revert "Merge pull request #627 from salesforcecli/revert-616-phale/r…
Browse files Browse the repository at this point in the history
…estructure-auth"

This reverts commit abf4e61, reversing
changes made to fdb40ee.

# Conflicts:
#	src/commands/org/login/access-token.ts
#	src/commands/org/login/web.ts
#	test/commands/org/login/login.web.test.ts
#	yarn.lock
  • Loading branch information
peternhale committed Feb 21, 2023
1 parent 455f601 commit 4bad5b3
Show file tree
Hide file tree
Showing 38 changed files with 1,030 additions and 481 deletions.
44 changes: 22 additions & 22 deletions command-snapshot.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
[
{
"command": "auth:accesstoken:store",
"command": "org:list:auth",
"plugin": "@salesforce/plugin-auth",
"flags": ["json", "loglevel"],
"alias": ["force:auth:list", "auth:list"]
},
{
"command": "org:login:access-token",
"plugin": "@salesforce/plugin-auth",
"flags": ["alias", "instance-url", "json", "loglevel", "no-prompt", "set-default", "set-default-dev-hub"],
"alias": ["force:auth:accesstoken:store"]
"alias": ["force:auth:accesstoken:store", "auth:accesstoken:store"]
},
{
"command": "auth:device:login",
"command": "org:login:device",
"plugin": "@salesforce/plugin-auth",
"flags": [
"alias",
Expand All @@ -18,10 +24,10 @@
"set-default",
"set-default-dev-hub"
],
"alias": ["force:auth:device:login"]
"alias": ["force:auth:device:login", "auth:device:login"]
},
{
"command": "auth:jwt:grant",
"command": "org:login:jwt",
"plugin": "@salesforce/plugin-auth",
"flags": [
"alias",
Expand All @@ -35,28 +41,16 @@
"set-default-dev-hub",
"username"
],
"alias": ["force:auth:jwt:grant"]
},
{
"command": "auth:list",
"plugin": "@salesforce/plugin-auth",
"flags": ["json", "loglevel"],
"alias": ["force:auth:list"]
"alias": ["force:auth:jwt:grant", "auth:jwt:grant"]
},
{
"command": "auth:logout",
"plugin": "@salesforce/plugin-auth",
"flags": ["all", "json", "loglevel", "no-prompt", "target-org"],
"alias": ["force:auth:logout"]
},
{
"command": "auth:sfdxurl:store",
"command": "org:login:sfdx-url",
"plugin": "@salesforce/plugin-auth",
"flags": ["alias", "json", "loglevel", "no-prompt", "set-default", "set-default-dev-hub", "sfdx-url-file"],
"alias": ["force:auth:sfdxurl:store"]
"alias": ["force:auth:sfdxurl:store", "auth:sfdxurl:store"]
},
{
"command": "auth:web:login",
"command": "org:login:web",
"plugin": "@salesforce/plugin-auth",
"flags": [
"alias",
Expand All @@ -70,6 +64,12 @@
"set-default",
"set-default-dev-hub"
],
"alias": ["force:auth:web:login"]
"alias": ["force:auth:web:login", "auth:web:login"]
},
{
"command": "org:logout",
"plugin": "@salesforce/plugin-auth",
"flags": ["all", "json", "loglevel", "no-prompt", "target-org"],
"alias": ["force:auth:logout", "auth:logout"]
}
]
12 changes: 7 additions & 5 deletions messages/accesstoken.store.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
# summary

authorize an org using an existing Salesforce access token
Authorize an org using an existing Salesforce access token.

# description

authorize an org using an existing Salesforce access token
By default, the command runs interactively and asks you for the access token. If you previously authorized the org, the command prompts whether you want to overwrite the local file. Specify --no-prompt to not be prompted.

To use the command in a CI/CD script, set the SFDX_ACCESS_TOKEN environment variable to the access token. Then run the command with the --no-prompt parameter.

# examples

- $ <%= config.bin %> <%= command.id %> --instance-url https://mycompany.my.salesforce.com
- Authorize an org on https://mycompany.my.salesforce.com; the command prompts you for the access token:

<%= config.bin %> <%= command.id %> --instance-url https://mycompany.my.salesforce.com

- $ export SFDX_ACCESS_TOKEN=00Dxx0000000000!xxxxx
- Authorize the org without being prompted; you must have previously set the SFDX_ACCESS_TOKEN environment variable to the access token:

- $ <%= config.bin %> <%= command.id %> --instance-url https://dev-hub.my.salesforce.com --no-prompt
<%= config.bin %> <%= command.id %> --instance-url https://dev-hub.my.salesforce.com --no-prompt

# invalidAccessTokenFormat

Expand Down
21 changes: 14 additions & 7 deletions messages/device.login.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,34 @@
# summary

authorize an org using a device code
Authorize an org using a device code.

# description

authorize an org using a device code
You must open a browser, navigate to the verification URL, and enter the code. Log in, if not already logged in, and you’ll be prompted to allow the device to connect to the org.
Use this command to allow a device to connect to an org.

When you run this command, it first displays an 8-digit device code and the URL for verifying the code on your org. The default instance URL is https://login.salesforce.com, so if the org you're authorizing is on a different instance, use the --instance-url. The command waits while you complete the verification. Open a browser and navigate to the displayed verification URL, enter the code, then click Connect. If you aren't already logged into your org, log in, and then you're prompted to allow the device to connect to the org. After you successfully authorize the org, you can close the browser window.

# examples

- $ <%= config.bin %> <%= command.id %> -d -a TestOrg1
- Authorize an org using a device code, give the org the alias TestOrg1, and set it as your default Dev Hub org:

<%= config.bin %> <%= command.id %> --set-default-dev-hub --alias TestOrg1

- Authorize an org in which you've created a custom connected app with the specified client ID (consumer key):

<%= config.bin %> <%= command.id %> --client-id <OAuth client id>

- $ <%= config.bin %> <%= command.id %> -i <OAuth client id>
- Authorize a sandbox org with the specified instance URL:

- $ <%= config.bin %> <%= command.id %> -r https://MyDomainName--SandboxName.sandbox.my.salesforce.com
<%= config.bin %> <%= command.id %> --instance-url https://MyDomainName--SandboxName.sandbox.my.salesforce.com

# actionRequired

Action Required!

# enterCode

Enter %s user code in the verification URL %s
Enter %s device code in this verification URL: %s

# success

Expand Down
42 changes: 31 additions & 11 deletions messages/jwt.grant.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,48 @@
# summary

authorize an org using the JWT flow
Log in to a Salesforce org using a JSON web token (JWT).

# description

authorize an org using the JWT flow
Use a certificate associated with your private key that has been uploaded to a personal connected app.
If you specify an --instanc-eurl value, this value overrides the sfdcLoginUrl value in your sfdx-project.json file. To specify a My Domain URL, use the format MyDomainName.my.salesforce.com (not MyDomainName.lightning.force.com). To specify a sandbox, set --instance-url to https://MyDomainName--SandboxName.sandbox.my.salesforce.com.
Use this command in automated environments where you can’t interactively log in with a browser, such as in CI/CD scripts.

Logging into an org authorizes the CLI to run other commands that connect to that org, such as deploying or retrieving a project. You can log into many types of orgs, such as sandboxes, Dev Hubs, Env Hubs, production orgs, and scratch orgs.

Complete these steps before you run this command:

1. Create a digital certificate (also called digital signature) and the private key to sign the certificate. You can use your own key and certificate issued by a certification authority. Or use OpenSSL to create a key and a self-signed digital certificate.
2. Store the private key in a file on your computer. When you run this command, you set the --jwt-key-file flag to this file.
3. Create a custom connected app in your org using the digital certificate. Make note of the consumer key (also called client id) that’s generated for you. Be sure the username of the user logging in is approved to use the connected app. When you run this command, you set the --client-id flag to the consumer key.

See https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_auth_jwt_flow.htm for more information.

We recommend that you set an alias when you log into an org. Aliases make it easy to later reference this org when running commands that require it. If you don’t set an alias, you use the username that you specified when you logged in to the org. If you run multiple commands that reference the same org, consider setting the org as your default. Use --set-default for your default scratch org or sandbox, or --set-default-dev-hub for your default Dev Hub.

# examples

- $ <%= config.bin %> <%= command.id %> -o me@my.org -f <path to jwt key file> -i <OAuth client id>
- Log into an org with username jdoe@example.org and on the default instance URL (https://login.salesforce.org). The private key is stored in the file /Users/jdoe/JWT/server.key and the command uses the connected app with consumer key (client id) 04580y4051234051.

<%= config.bin %> <%= command.id %> --username jdoe@example.org --jwt-key-file /Users/jdoe/JWT/server.key --client-id 04580y4051234051

- Set the org as the default and give it an alias:

<%= config.bin %> <%= command.id %> --username jdoe@example.org --jwt-key-file /Users/jdoe/JWT/server.key --client-id 04580y4051234051 --alias ci-org --set-default

- Set the org as the default Dev Hub and give it an alias:

<%= config.bin %> <%= command.id %> --username jdoe@example.org --jwt-key-file /Users/jdoe/JWT/server.key --client-id 04580y4051234051 --alias ci-dev-hub --set-default-dev-hub

- $ <%= config.bin %> <%= command.id %> -o me@my.org -f <path to jwt key file> -i <OAuth client id> -s -a MyDefaultOrg
- Log in to a sandbox using URL https://MyDomainName--SandboxName.sandbox.my.salesforce.com:

- $ <%= config.bin %> <%= command.id %> -o me@acme.org -f <path to jwt key file> -i <OAuth client id> -r https://acme.my.salesforce.com
<%= config.bin %> <%= command.id %> --username jdoe@example.org --jwt-key-file /Users/jdoe/JWT/server.key --client-id 04580y4051234051 --alias ci-org --set-default --instance-url https://MyDomainName--SandboxName.sandbox.my.salesforce.com

# username
# flags.username.summary

authentication username
Username of the user logging in.

# key
# flags.jwt-key-file.summary

path to a file containing the private key
Path to a file containing the private key.

# JwtGrantError

Expand Down
10 changes: 6 additions & 4 deletions messages/list.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# summary

List auth connection information
List authorization information about the orgs you created or logged into.

# description

list auth connection information
This command uses local authorization information that Salesforce CLI caches when you create a scratch org or log into an org. The command doesn't actually connect to the orgs to verify that they're still active. As a result, this command executes very quickly. If you want to view live information about your authorized orgs, such as their connection status, use the "org list" command.

# examples

- $ <%= config.bin %> <%= command.id %>
- List local authorization information about your orgs:

<%= config.bin %> <%= command.id %>

# noResultsFound

No results found
No results found.
72 changes: 54 additions & 18 deletions messages/logout.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,81 @@
# summary

log out from authorized orgs
Log out of a Salesforce org.

# description

log out from authorized orgs
By default, this command logs you out from your default scratch org.
If you run this command with no flags, it first displays a list of orgs you've created or logged into, with none of the orgs selected. Use the arrow keys to scroll through the list and the space bar to select the orgs you want to log out of. Press Enter when you're done; the command asks for a final confirmation before logging out of the selected orgs.

The process is similar if you specify --all, except that in the initial list of orgs, they're all selected. Use --target-org to logout of a specific org. In both these cases by default, you must still confirm that you want to log out. Use --no-prompt to never be asked for confirmation when also using --all or --target-org.

Be careful! If you log out of a scratch org without having access to its password, you can't access the scratch org again, either through the CLI or the Salesforce UI.

# examples

- $ <%= config.bin %> <%= command.id %> -o me@my.org
- Interactively select the orgs to log out of:

- $ <%= config.bin %> <%= command.id %> -a
<%= config.bin %> <%= command.id %>

- $ <%= config.bin %> <%= command.id %> -p
- Log out of the org with username me@my.org:

# flags.target-org.summary
<%= config.bin %> <%= command.id %> --target-org me@my.org

Username or alias of the target org.
- Log out of all orgs after confirmation:

<%= config.bin %> <%= command.id %> --all

# all
- Logout of the org with alias my-scratch and don't prompt for confirmation:

include all authenticated orgs
<%= config.bin %> <%= command.id %> --target-org my-scratch --no-prompt

# allLong
# flags.target-org.summary

Includes all authenticated orgs: for example, Dev Hubs, sandboxes, DE orgs, and expired, deleted, and unknown-status scratch orgs.
Username or alias of the target org.

# logoutCommandYesNo
# flags.all.summary

Are you sure you want to log out from these org(s)?
%s
Include all authenticated orgs.

Important: You need a password to reauthorize scratch orgs. By default, scratch orgs have no password. If you still need your scratch orgs, run "%s org:generate:password" before logging out. If you don't need the scratch orgs anymore, run "%s org:delete:scratch" or "%s org:delete:sandbox"instead of logging out.
# flags.all.description

Log out?
All orgs includes Dev Hubs, sandboxes, DE orgs, and expired, deleted, and unknown-status scratch orgs.

# logoutOrgCommandSuccess

Successfully logged out of orgs: %s

# logoutOrgCommandNoOrgsFound
# noOrgsFound

No orgs found to log out of.

# noOrgsSelected

No orgs selected for logout.

# prompt.select-envs

Select the orgs you want to log out of:

# prompt.confirm

Are you sure you want to log out of %d org%s?

# prompt.confirm-all

Are you sure you want to log out of all your orgs?

# prompt.confirm.single

Are you sure you want to log out of %s?

# warning

Warning: If you log out of a scratch org without having access to its password, you can't access this org again, either through the CLI or the Salesforce UI.

# noOrgSpecifiedWithNoPrompt

You must specify a target-org (or default target-org config is set) or use --all flag when using the --no-prompt flag.

# noOrgSpecifiedWithJson

You must specify a target-org (or default target-org config is set) or use --all flag when using the --json flag.
38 changes: 23 additions & 15 deletions messages/messages.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,48 @@
# clientId
# flags.client-id.summary

OAuth client ID (sometimes called the consumer key)
OAuth client ID (also called consumer key) of your custom connected app.

# setDefaultDevHub
# flags.set-default-dev-hub.summary

set the authenticated org as the default dev hub org for scratch org creation
Set the authenticated org as the default Dev Hub.

# setDefaultUsername
# flags.set-default.summary

set the authenticated org as the default username that all commands run against
Set the authenticated org as the default that all org-related commands run against.

# setAlias
# flags.alias.summary

set an alias for the authenticated org
Alias for the org.

# instanceUrl
# flags.instance-url.summary

the login URL of the instance the org lives on
URL of the instance that the org lives on.

# flags.instance-url.description

If you specify an --instance-url value, this value overrides the sfdcLoginUrl value in your sfdx-project.json file.

To specify a My Domain URL, use the format https://yourcompanyname.my.salesforce.com.

To specify a sandbox, set --instance-url to https://MyDomainName--SandboxName.sandbox.my.salesforce.com.

# authorizeCommandSuccess

Successfully authorized %s with org ID %s

# warnAuth

Logging in to a business or production org is not recommended on a demo or shared machine. Please run "%s auth:logout --target-org <your username> --no-prompt" when finished using this org, which is similar to logging out of the org in the browser.
Logging in to a business or production org is not recommended on a demo or shared machine. Please run "%s org:logout --target-org <your username> --no-prompt" when finished using this org, which is similar to logging out of the org in the browser.

Do you want to authorize this org for use with the Salesforce CLI?

# noPromptAuth
# flags.no-prompt.summary

do not prompt for auth confirmation in demo mode
Don't prompt for confirmation.

# disableMasking
# flags.disable-masking.summary

disable masking of user input (for use with problematic terminals)
Disable masking of user input; use with problematic terminals.

# clientSecretStdin

Expand Down
Loading

0 comments on commit 4bad5b3

Please sign in to comment.