@salesforce/plugin-auth 3.3.26 → 3.4.0
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/README.md +2 -448
- package/lib/common.js +11 -11
- package/lib/common.js.map +1 -1
- package/npm-shrinkwrap.json +1739 -5140
- package/oclif.lock +1101 -3188
- package/oclif.manifest.json +1 -1
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -70,454 +70,8 @@ sfdx plugins
|
|
|
70
70
|
|
|
71
71
|
<!-- commands -->
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
- [`sf org login access-token`](#sf-org-login-access-token)
|
|
75
|
-
- [`sf org login device`](#sf-org-login-device)
|
|
76
|
-
- [`sf org login jwt`](#sf-org-login-jwt)
|
|
77
|
-
- [`sf org login sfdx-url`](#sf-org-login-sfdx-url)
|
|
78
|
-
- [`sf org login web`](#sf-org-login-web)
|
|
79
|
-
- [`sf org logout`](#sf-org-logout)
|
|
73
|
+
# Command Topics
|
|
80
74
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
List authorization information about the orgs you created or logged into.
|
|
84
|
-
|
|
85
|
-
```
|
|
86
|
-
USAGE
|
|
87
|
-
$ sf org list auth [--json]
|
|
88
|
-
|
|
89
|
-
GLOBAL FLAGS
|
|
90
|
-
--json Format output as json.
|
|
91
|
-
|
|
92
|
-
DESCRIPTION
|
|
93
|
-
List authorization information about the orgs you created or logged into.
|
|
94
|
-
|
|
95
|
-
This command uses local authorization information that Salesforce CLI caches when you create a scratch org or log into
|
|
96
|
-
an org. The command doesn't actually connect to the orgs to verify that they're still active. As a result, this
|
|
97
|
-
command executes very quickly. If you want to view live information about your authorized orgs, such as their
|
|
98
|
-
connection status, use the "org list" command.
|
|
99
|
-
|
|
100
|
-
ALIASES
|
|
101
|
-
$ sf force auth list
|
|
102
|
-
$ sf auth list
|
|
103
|
-
|
|
104
|
-
EXAMPLES
|
|
105
|
-
List local authorization information about your orgs:
|
|
106
|
-
|
|
107
|
-
$ sf org list auth
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
_See code: [src/commands/org/list/auth.ts](https://github.com/salesforcecli/plugin-auth/blob/3.3.26/src/commands/org/list/auth.ts)_
|
|
111
|
-
|
|
112
|
-
## `sf org login access-token`
|
|
113
|
-
|
|
114
|
-
Authorize an org using an existing Salesforce access token.
|
|
115
|
-
|
|
116
|
-
```
|
|
117
|
-
USAGE
|
|
118
|
-
$ sf org login access-token -r <value> [--json] [-d] [-s] [-a <value>] [-p]
|
|
119
|
-
|
|
120
|
-
FLAGS
|
|
121
|
-
-a, --alias=<value> Alias for the org.
|
|
122
|
-
-d, --set-default-dev-hub Set the authenticated org as the default Dev Hub.
|
|
123
|
-
-p, --no-prompt Don't prompt for confirmation.
|
|
124
|
-
-r, --instance-url=<value> (required) URL of the instance that the org lives on.
|
|
125
|
-
-s, --set-default Set the authenticated org as the default that all org-related commands run against.
|
|
126
|
-
|
|
127
|
-
GLOBAL FLAGS
|
|
128
|
-
--json Format output as json.
|
|
129
|
-
|
|
130
|
-
DESCRIPTION
|
|
131
|
-
Authorize an org using an existing Salesforce access token.
|
|
132
|
-
|
|
133
|
-
By default, the command runs interactively and asks you for the access token. If you previously authorized the org,
|
|
134
|
-
the command prompts whether you want to overwrite the local file. Specify --no-prompt to not be prompted.
|
|
135
|
-
|
|
136
|
-
To use the command in a CI/CD script, set the SFDX_ACCESS_TOKEN environment variable to the access token. Then run the
|
|
137
|
-
command with the --no-prompt parameter.
|
|
138
|
-
|
|
139
|
-
ALIASES
|
|
140
|
-
$ sf force auth accesstoken store
|
|
141
|
-
$ sf auth accesstoken store
|
|
142
|
-
|
|
143
|
-
EXAMPLES
|
|
144
|
-
Authorize an org on https://mycompany.my.salesforce.com; the command prompts you for the access token:
|
|
145
|
-
|
|
146
|
-
$ sf org login access-token --instance-url https://mycompany.my.salesforce.com
|
|
147
|
-
|
|
148
|
-
Authorize the org without being prompted; you must have previously set the SF_ACCESS_TOKEN environment variable to
|
|
149
|
-
the access token:
|
|
150
|
-
|
|
151
|
-
$ sf org login access-token --instance-url https://dev-hub.my.salesforce.com --no-prompt
|
|
152
|
-
|
|
153
|
-
FLAG DESCRIPTIONS
|
|
154
|
-
-r, --instance-url=<value> URL of the instance that the org lives on.
|
|
155
|
-
|
|
156
|
-
If you specify an --instance-url value, this value overrides the sfdcLoginUrl value in your sfdx-project.json file.
|
|
157
|
-
|
|
158
|
-
To specify a My Domain URL, use the format "https://<MyDomainName>.my.salesforce.com".
|
|
159
|
-
|
|
160
|
-
To specify a sandbox, set --instance-url to "https://<MyDomainName>--<SandboxName>.sandbox.my.salesforce.com".
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
_See code: [src/commands/org/login/access-token.ts](https://github.com/salesforcecli/plugin-auth/blob/3.3.26/src/commands/org/login/access-token.ts)_
|
|
164
|
-
|
|
165
|
-
## `sf org login device`
|
|
166
|
-
|
|
167
|
-
Authorize an org using a device code.
|
|
168
|
-
|
|
169
|
-
```
|
|
170
|
-
USAGE
|
|
171
|
-
$ sf org login device [--json] [-i <value>] [-r <value>] [-d] [-s] [-a <value>]
|
|
172
|
-
|
|
173
|
-
FLAGS
|
|
174
|
-
-a, --alias=<value> Alias for the org.
|
|
175
|
-
-d, --set-default-dev-hub Set the authenticated org as the default Dev Hub.
|
|
176
|
-
-i, --client-id=<value> OAuth client ID (also called consumer key) of your custom connected app.
|
|
177
|
-
-r, --instance-url=<value> URL of the instance that the org lives on.
|
|
178
|
-
-s, --set-default Set the authenticated org as the default that all org-related commands run against.
|
|
179
|
-
|
|
180
|
-
GLOBAL FLAGS
|
|
181
|
-
--json Format output as json.
|
|
182
|
-
|
|
183
|
-
DESCRIPTION
|
|
184
|
-
Authorize an org using a device code.
|
|
185
|
-
|
|
186
|
-
Use this command to allow a device to connect to an org.
|
|
187
|
-
|
|
188
|
-
When you run this command, it first displays an 8-digit device code and the URL for verifying the code on your org.
|
|
189
|
-
The default instance URL is https://login.salesforce.com, so if the org you're authorizing is on a different instance,
|
|
190
|
-
use the --instance-url. The command waits while you complete the verification. Open a browser and navigate to the
|
|
191
|
-
displayed verification URL, enter the code, then click Connect. If you aren't already logged into your org, log in,
|
|
192
|
-
and then you're prompted to allow the device to connect to the org. After you successfully authorize the org, you can
|
|
193
|
-
close the browser window.
|
|
194
|
-
|
|
195
|
-
ALIASES
|
|
196
|
-
$ sf force auth device login
|
|
197
|
-
$ sf auth device login
|
|
198
|
-
|
|
199
|
-
EXAMPLES
|
|
200
|
-
Authorize an org using a device code, give the org the alias TestOrg1, and set it as your default Dev Hub org:
|
|
201
|
-
|
|
202
|
-
$ sf org login device --set-default-dev-hub --alias TestOrg1
|
|
203
|
-
|
|
204
|
-
Authorize an org in which you've created a custom connected app with the specified client ID (consumer key):
|
|
205
|
-
|
|
206
|
-
$ sf org login device --client-id <OAuth client id>
|
|
207
|
-
|
|
208
|
-
Authorize a sandbox org with the specified instance URL:
|
|
209
|
-
|
|
210
|
-
$ sf org login device --instance-url https://MyDomainName--SandboxName.sandbox.my.salesforce.com
|
|
211
|
-
|
|
212
|
-
FLAG DESCRIPTIONS
|
|
213
|
-
-r, --instance-url=<value> URL of the instance that the org lives on.
|
|
214
|
-
|
|
215
|
-
If you specify an --instance-url value, this value overrides the sfdcLoginUrl value in your sfdx-project.json file.
|
|
216
|
-
|
|
217
|
-
To specify a My Domain URL, use the format "https://<MyDomainName>.my.salesforce.com".
|
|
218
|
-
|
|
219
|
-
To specify a sandbox, set --instance-url to "https://<MyDomainName>--<SandboxName>.sandbox.my.salesforce.com".
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
_See code: [src/commands/org/login/device.ts](https://github.com/salesforcecli/plugin-auth/blob/3.3.26/src/commands/org/login/device.ts)_
|
|
223
|
-
|
|
224
|
-
## `sf org login jwt`
|
|
225
|
-
|
|
226
|
-
Log in to a Salesforce org using a JSON web token (JWT).
|
|
227
|
-
|
|
228
|
-
```
|
|
229
|
-
USAGE
|
|
230
|
-
$ sf org login jwt -o <value> -f <value> -i <value> [--json] [-r <value>] [-d] [-s] [-a <value>]
|
|
231
|
-
|
|
232
|
-
FLAGS
|
|
233
|
-
-a, --alias=<value> Alias for the org.
|
|
234
|
-
-d, --set-default-dev-hub Set the authenticated org as the default Dev Hub.
|
|
235
|
-
-f, --jwt-key-file=<value> (required) Path to a file containing the private key.
|
|
236
|
-
-i, --client-id=<value> (required) OAuth client ID (also called consumer key) of your custom connected app.
|
|
237
|
-
-o, --username=<value> (required) Username of the user logging in.
|
|
238
|
-
-r, --instance-url=<value> URL of the instance that the org lives on.
|
|
239
|
-
-s, --set-default Set the authenticated org as the default that all org-related commands run against.
|
|
240
|
-
|
|
241
|
-
GLOBAL FLAGS
|
|
242
|
-
--json Format output as json.
|
|
243
|
-
|
|
244
|
-
DESCRIPTION
|
|
245
|
-
Log in to a Salesforce org using a JSON web token (JWT).
|
|
246
|
-
|
|
247
|
-
Use this command in automated environments where you can’t interactively log in with a browser, such as in CI/CD
|
|
248
|
-
scripts.
|
|
249
|
-
|
|
250
|
-
Logging into an org authorizes the CLI to run other commands that connect to that org, such as deploying or retrieving
|
|
251
|
-
a project. You can log into many types of orgs, such as sandboxes, Dev Hubs, Env Hubs, production orgs, and scratch
|
|
252
|
-
orgs.
|
|
253
|
-
|
|
254
|
-
Complete these steps before you run this command:
|
|
255
|
-
|
|
256
|
-
1. Create a digital certificate (also called digital signature) and the private key to sign the certificate. You can
|
|
257
|
-
use your own key and certificate issued by a certification authority. Or use OpenSSL to create a key and a self-signed
|
|
258
|
-
digital certificate.
|
|
259
|
-
2. Store the private key in a file on your computer. When you run this command, you set the --jwt-key-file flag to
|
|
260
|
-
this file.
|
|
261
|
-
3. Create a custom connected app in your org using the digital certificate. Make note of the consumer key (also called
|
|
262
|
-
client id) that’s generated for you. Be sure the username of the user logging in is approved to use the connected app.
|
|
263
|
-
When you run this command, you set the --client-id flag to the consumer key.
|
|
264
|
-
|
|
265
|
-
See https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_auth_jwt_flow.htm for more
|
|
266
|
-
information.
|
|
267
|
-
|
|
268
|
-
We recommend that you set an alias when you log into an org. Aliases make it easy to later reference this org when
|
|
269
|
-
running commands that require it. If you don’t set an alias, you use the username that you specified when you logged
|
|
270
|
-
in to the org. If you run multiple commands that reference the same org, consider setting the org as your default. Use
|
|
271
|
-
--set-default for your default scratch org or sandbox, or --set-default-dev-hub for your default Dev Hub.
|
|
272
|
-
|
|
273
|
-
ALIASES
|
|
274
|
-
$ sf force auth jwt grant
|
|
275
|
-
$ sf auth jwt grant
|
|
276
|
-
|
|
277
|
-
EXAMPLES
|
|
278
|
-
Log into an org with username jdoe@example.org and on the default instance URL (https://login.salesforce.com). The
|
|
279
|
-
private key is stored in the file /Users/jdoe/JWT/server.key and the command uses the connected app with consumer
|
|
280
|
-
key (client id) 04580y4051234051.
|
|
281
|
-
|
|
282
|
-
$ sf org login jwt --username jdoe@example.org --jwt-key-file /Users/jdoe/JWT/server.key --client-id \
|
|
283
|
-
04580y4051234051
|
|
284
|
-
|
|
285
|
-
Set the org as the default and give it an alias:
|
|
286
|
-
|
|
287
|
-
$ sf org login jwt --username jdoe@example.org --jwt-key-file /Users/jdoe/JWT/server.key --client-id \
|
|
288
|
-
04580y4051234051 --alias ci-org --set-default
|
|
289
|
-
|
|
290
|
-
Set the org as the default Dev Hub and give it an alias:
|
|
291
|
-
|
|
292
|
-
$ sf org login jwt --username jdoe@example.org --jwt-key-file /Users/jdoe/JWT/server.key --client-id \
|
|
293
|
-
04580y4051234051 --alias ci-dev-hub --set-default-dev-hub
|
|
294
|
-
|
|
295
|
-
Log in to a sandbox using URL https://MyDomainName--SandboxName.sandbox.my.salesforce.com:
|
|
296
|
-
|
|
297
|
-
$ sf org login jwt --username jdoe@example.org --jwt-key-file /Users/jdoe/JWT/server.key --client-id \
|
|
298
|
-
04580y4051234051 --alias ci-org --set-default --instance-url \
|
|
299
|
-
https://MyDomainName--SandboxName.sandbox.my.salesforce.com
|
|
300
|
-
|
|
301
|
-
FLAG DESCRIPTIONS
|
|
302
|
-
-r, --instance-url=<value> URL of the instance that the org lives on.
|
|
303
|
-
|
|
304
|
-
If you specify an --instance-url value, this value overrides the sfdcLoginUrl value in your sfdx-project.json file.
|
|
305
|
-
|
|
306
|
-
To specify a My Domain URL, use the format "https://<MyDomainName>.my.salesforce.com".
|
|
307
|
-
|
|
308
|
-
To specify a sandbox, set --instance-url to "https://<MyDomainName>--<SandboxName>.sandbox.my.salesforce.com".
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
_See code: [src/commands/org/login/jwt.ts](https://github.com/salesforcecli/plugin-auth/blob/3.3.26/src/commands/org/login/jwt.ts)_
|
|
312
|
-
|
|
313
|
-
## `sf org login sfdx-url`
|
|
314
|
-
|
|
315
|
-
Authorize an org using a Salesforce DX authorization URL stored in a file or through standard input (stdin).
|
|
316
|
-
|
|
317
|
-
```
|
|
318
|
-
USAGE
|
|
319
|
-
$ sf org login sfdx-url [--json] [-f <value>] [-u <value>] [-d] [-s] [-a <value>]
|
|
320
|
-
|
|
321
|
-
FLAGS
|
|
322
|
-
-a, --alias=<value> Alias for the org.
|
|
323
|
-
-d, --set-default-dev-hub Set the authenticated org as the default Dev Hub.
|
|
324
|
-
-f, --sfdx-url-file=<value> Path to a file that contains the Salesforce DX authorization URL.
|
|
325
|
-
-s, --set-default Set the authenticated org as the default that all org-related commands run against.
|
|
326
|
-
-u, --sfdx-url-stdin=<value> Pipe the Salesforce DX authorization URL through standard input (stdin).
|
|
327
|
-
|
|
328
|
-
GLOBAL FLAGS
|
|
329
|
-
--json Format output as json.
|
|
330
|
-
|
|
331
|
-
DESCRIPTION
|
|
332
|
-
Authorize an org using a Salesforce DX authorization URL stored in a file or through standard input (stdin).
|
|
333
|
-
|
|
334
|
-
The Salesforce DX (SFDX) authorization URL must have the format
|
|
335
|
-
"force://<clientId>:<clientSecret>:<refreshToken>@<instanceUrl>". NOTE: The SFDX authorization URL uses the "force"
|
|
336
|
-
protocol, and not "http" or "https". Also, the "instanceUrl" inside the SFDX authorization URL doesn't include the
|
|
337
|
-
protocol ("https://").
|
|
338
|
-
|
|
339
|
-
You have three options when creating the authorization file. The easiest option is to redirect the output of the "sf
|
|
340
|
-
org display --verbose --json" command into a file. For example, using an org with alias my-org that you've already
|
|
341
|
-
authorized:
|
|
342
|
-
|
|
343
|
-
$ sf org display --target-org my-org --verbose --json > authFile.json
|
|
344
|
-
|
|
345
|
-
The resulting JSON file contains the URL in the "sfdxAuthUrl" property of the "result" object. You can then reference
|
|
346
|
-
the file when running this command:
|
|
347
|
-
|
|
348
|
-
$ sf org login sfdx-url --sfdx-url-file authFile.json
|
|
349
|
-
|
|
350
|
-
NOTE: The "sf org display --verbose" command displays the refresh token only for orgs authorized with the web server
|
|
351
|
-
flow, and not the JWT bearer flow.
|
|
352
|
-
|
|
353
|
-
You can also create a JSON file that has a top-level property named sfdxAuthUrl whose value is the authorization URL.
|
|
354
|
-
Finally, you can create a normal text file that includes just the URL and nothing else.
|
|
355
|
-
|
|
356
|
-
Alternatively, you can pipe the SFDX authorization URL through standard input by specifying the --sfdx-url-stdin flag.
|
|
357
|
-
|
|
358
|
-
ALIASES
|
|
359
|
-
$ sf force auth sfdxurl store
|
|
360
|
-
$ sf auth sfdxurl store
|
|
361
|
-
|
|
362
|
-
EXAMPLES
|
|
363
|
-
Authorize an org using the SFDX authorization URL in the files/authFile.json file:
|
|
364
|
-
|
|
365
|
-
$ sf org login sfdx-url --sfdx-url-file files/authFile.json
|
|
366
|
-
|
|
367
|
-
Similar to previous example, but set the org as your default and give it an alias MyDefaultOrg:
|
|
368
|
-
|
|
369
|
-
$ sf org login sfdx-url --sfdx-url-file files/authFile.json --set-default --alias MyDefaultOrg
|
|
370
|
-
|
|
371
|
-
Pipe the SFDX authorization URL from stdin:
|
|
372
|
-
|
|
373
|
-
$ echo url | sf org login sfdx-url --sfdx-url-stdin
|
|
374
|
-
```
|
|
375
|
-
|
|
376
|
-
_See code: [src/commands/org/login/sfdx-url.ts](https://github.com/salesforcecli/plugin-auth/blob/3.3.26/src/commands/org/login/sfdx-url.ts)_
|
|
377
|
-
|
|
378
|
-
## `sf org login web`
|
|
379
|
-
|
|
380
|
-
Log in to a Salesforce org using the web server flow.
|
|
381
|
-
|
|
382
|
-
```
|
|
383
|
-
USAGE
|
|
384
|
-
$ sf org login web [--json] [-b chrome|edge|firefox] [-i <value>] [-r <value>] [-d] [-s] [-a <value>]
|
|
385
|
-
|
|
386
|
-
FLAGS
|
|
387
|
-
-a, --alias=<value> Alias for the org.
|
|
388
|
-
-b, --browser=<option> Browser in which to open the org.
|
|
389
|
-
<options: chrome|edge|firefox>
|
|
390
|
-
-d, --set-default-dev-hub Set the authenticated org as the default Dev Hub.
|
|
391
|
-
-i, --client-id=<value> OAuth client ID (also called consumer key) of your custom connected app.
|
|
392
|
-
-r, --instance-url=<value> URL of the instance that the org lives on.
|
|
393
|
-
-s, --set-default Set the authenticated org as the default that all org-related commands run against.
|
|
394
|
-
|
|
395
|
-
GLOBAL FLAGS
|
|
396
|
-
--json Format output as json.
|
|
397
|
-
|
|
398
|
-
DESCRIPTION
|
|
399
|
-
Log in to a Salesforce org using the web server flow.
|
|
400
|
-
|
|
401
|
-
Opens a Salesforce instance URL in a web browser so you can enter your credentials and log in to your org. After you
|
|
402
|
-
log in, you can close the browser window.
|
|
403
|
-
|
|
404
|
-
Logging into an org authorizes the CLI to run other commands that connect to that org, such as deploying or retrieving
|
|
405
|
-
metadata. You can log into many types of orgs, such as sandboxes, Dev Hubs, Env Hubs, production orgs, and scratch
|
|
406
|
-
orgs.
|
|
407
|
-
|
|
408
|
-
We recommend that you set an alias when you log into an org. Aliases make it easy to later reference this org when
|
|
409
|
-
running commands that require it. If you don’t set an alias, you use the username that you specified when you logged
|
|
410
|
-
in to the org. If you run multiple commands that reference the same org, consider setting the org as your default. Use
|
|
411
|
-
--set-default for your default scratch org or sandbox, or --set-default-dev-hub for your default Dev Hub.
|
|
412
|
-
|
|
413
|
-
By default, this command uses the global out-of-the-box connected app in your org. If you need more security or
|
|
414
|
-
control, such as setting the refresh token timeout or specifying IP ranges, create your own connected app using a
|
|
415
|
-
digital certificate. Make note of the consumer key (also called cliend id) that’s generated for you. Then specify the
|
|
416
|
-
consumer key with the --client-id flag.
|
|
417
|
-
|
|
418
|
-
ALIASES
|
|
419
|
-
$ sf force auth web login
|
|
420
|
-
$ sf auth web login
|
|
421
|
-
|
|
422
|
-
EXAMPLES
|
|
423
|
-
Run the command with no flags to open the default Salesforce login page (https://login.salesforce.com):
|
|
424
|
-
|
|
425
|
-
$ sf org login web
|
|
426
|
-
|
|
427
|
-
Log in to your Dev Hub, set it as your default Dev Hub, and set an alias that you reference later when you create a
|
|
428
|
-
scratch org:
|
|
429
|
-
|
|
430
|
-
$ sf org login web --set-default-dev-hub --alias dev-hub
|
|
431
|
-
|
|
432
|
-
Log in to a sandbox and set it as your default org:
|
|
433
|
-
|
|
434
|
-
$ sf org login web --instance-url https://MyDomainName--SandboxName.sandbox.my.salesforce.com --set-default
|
|
435
|
-
|
|
436
|
-
Use --browser to specify a specific browser, such as Google Chrome:
|
|
437
|
-
|
|
438
|
-
$ sf org login web --instance-url https://MyDomainName--SandboxName.sandbox.my.salesforce.com --set-default \
|
|
439
|
-
--browser chrome
|
|
440
|
-
|
|
441
|
-
Use your own connected app by specifying its consumer key (also called client ID):
|
|
442
|
-
|
|
443
|
-
$ sf org login web --instance-url https://MyDomainName--SandboxName.sandbox.my.salesforce.com --set-default \
|
|
444
|
-
--browser chrome --client-id 04580y4051234051
|
|
445
|
-
|
|
446
|
-
FLAG DESCRIPTIONS
|
|
447
|
-
-b, --browser=chrome|edge|firefox Browser in which to open the org.
|
|
448
|
-
|
|
449
|
-
If you don’t specify --browser, the command uses your default browser. The exact names of the browser applications
|
|
450
|
-
differ depending on the operating system you're on; check your documentation for details.
|
|
451
|
-
|
|
452
|
-
-r, --instance-url=<value> URL of the instance that the org lives on.
|
|
453
|
-
|
|
454
|
-
If you specify an --instance-url value, this value overrides the sfdcLoginUrl value in your sfdx-project.json file.
|
|
455
|
-
|
|
456
|
-
To specify a My Domain URL, use the format "https://<MyDomainName>.my.salesforce.com".
|
|
457
|
-
|
|
458
|
-
To specify a sandbox, set --instance-url to "https://<MyDomainName>--<SandboxName>.sandbox.my.salesforce.com".
|
|
459
|
-
```
|
|
460
|
-
|
|
461
|
-
_See code: [src/commands/org/login/web.ts](https://github.com/salesforcecli/plugin-auth/blob/3.3.26/src/commands/org/login/web.ts)_
|
|
462
|
-
|
|
463
|
-
## `sf org logout`
|
|
464
|
-
|
|
465
|
-
Log out of a Salesforce org.
|
|
466
|
-
|
|
467
|
-
```
|
|
468
|
-
USAGE
|
|
469
|
-
$ sf org logout [--json] [-a | -o <value>] [-p]
|
|
470
|
-
|
|
471
|
-
FLAGS
|
|
472
|
-
-a, --all Include all authenticated orgs.
|
|
473
|
-
-o, --target-org=<value> Username or alias of the target org.
|
|
474
|
-
-p, --no-prompt Don't prompt for confirmation.
|
|
475
|
-
|
|
476
|
-
GLOBAL FLAGS
|
|
477
|
-
--json Format output as json.
|
|
478
|
-
|
|
479
|
-
DESCRIPTION
|
|
480
|
-
Log out of a Salesforce org.
|
|
481
|
-
|
|
482
|
-
If you run this command with no flags and no default org set in your config or environment, it first displays a list
|
|
483
|
-
of orgs you've created or logged into, with none of the orgs selected. Use the arrow keys to scroll through the list
|
|
484
|
-
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
|
|
485
|
-
final confirmation before logging out of the selected orgs.
|
|
486
|
-
|
|
487
|
-
The process is similar if you specify --all, except that in the initial list of orgs, they're all selected. Use
|
|
488
|
-
--target-org to logout of a specific org. In both these cases by default, you must still confirm that you want to log
|
|
489
|
-
out. Use --no-prompt to never be asked for confirmation when also using --all or --target-org.
|
|
490
|
-
|
|
491
|
-
Be careful! If you log out of a scratch org without having access to its password, you can't access the scratch org
|
|
492
|
-
again, either through the CLI or the Salesforce UI.
|
|
493
|
-
|
|
494
|
-
ALIASES
|
|
495
|
-
$ sf force auth logout
|
|
496
|
-
$ sf auth logout
|
|
497
|
-
|
|
498
|
-
EXAMPLES
|
|
499
|
-
Interactively select the orgs to log out of:
|
|
500
|
-
|
|
501
|
-
$ sf org logout
|
|
502
|
-
|
|
503
|
-
Log out of the org with username me@my.org:
|
|
504
|
-
|
|
505
|
-
$ sf org logout --target-org me@my.org
|
|
506
|
-
|
|
507
|
-
Log out of all orgs after confirmation:
|
|
508
|
-
|
|
509
|
-
$ sf org logout --all
|
|
510
|
-
|
|
511
|
-
Logout of the org with alias my-scratch and don't prompt for confirmation:
|
|
512
|
-
|
|
513
|
-
$ sf org logout --target-org my-scratch --no-prompt
|
|
514
|
-
|
|
515
|
-
FLAG DESCRIPTIONS
|
|
516
|
-
-a, --all Include all authenticated orgs.
|
|
517
|
-
|
|
518
|
-
All orgs includes Dev Hubs, sandboxes, DE orgs, and expired, deleted, and unknown-status scratch orgs.
|
|
519
|
-
```
|
|
520
|
-
|
|
521
|
-
_See code: [src/commands/org/logout.ts](https://github.com/salesforcecli/plugin-auth/blob/3.3.26/src/commands/org/logout.ts)_
|
|
75
|
+
- [`sf org`](docs/org.md)
|
|
522
76
|
|
|
523
77
|
<!-- commandsstop -->
|
package/lib/common.js
CHANGED
|
@@ -12,27 +12,27 @@ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
|
12
12
|
const messages = Messages.loadMessages('@salesforce/plugin-auth', 'messages');
|
|
13
13
|
const resolveLoginUrl = async (instanceUrl) => {
|
|
14
14
|
const logger = await Logger.child('Common', { tag: 'resolveLoginUrl' });
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
const loginUrl = instanceUrl ?? (await getLoginUrl(logger));
|
|
16
|
+
throwIfLightning(loginUrl);
|
|
17
|
+
logger.debug(`loginUrl: ${loginUrl}`);
|
|
18
|
+
return loginUrl;
|
|
19
|
+
};
|
|
20
|
+
/** try to get url from project if there is one, otherwise use the default production URL */
|
|
21
|
+
const getLoginUrl = async (logger) => {
|
|
20
22
|
try {
|
|
21
23
|
const project = await SfProject.resolve();
|
|
22
24
|
const projectJson = await project.resolveProjectConfig();
|
|
23
|
-
|
|
25
|
+
return getString(projectJson, 'sfdcLoginUrl', SfdcUrl.PRODUCTION);
|
|
24
26
|
}
|
|
25
27
|
catch (err) {
|
|
26
28
|
const message = (isObject(err) ? Reflect.get(err, 'message') ?? err : err);
|
|
27
29
|
logger.debug(`error occurred while trying to determine loginUrl: ${message}`);
|
|
28
|
-
|
|
30
|
+
return SfdcUrl.PRODUCTION;
|
|
29
31
|
}
|
|
30
|
-
throwIfLightning(loginUrl);
|
|
31
|
-
logger.debug(`loginUrl: ${loginUrl}`);
|
|
32
|
-
return loginUrl;
|
|
33
32
|
};
|
|
34
33
|
const throwIfLightning = (urlString) => {
|
|
35
|
-
|
|
34
|
+
const url = new SfdcUrl(urlString);
|
|
35
|
+
if (url.isLightningDomain() || (url.isInternalUrl() && url.origin.includes('.lightning.'))) {
|
|
36
36
|
throw new SfError(messages.getMessage('lightningInstanceUrl'), 'LightningDomain', [
|
|
37
37
|
messages.getMessage('flags.instance-url.description'),
|
|
38
38
|
]);
|
package/lib/common.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAEtD,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,C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