Skip to content

Commit f7b4941

Browse files
atsansoneMaryaBelanger
authored and
Tony Sansone
committed
Apply suggestions from @MaryaBelanger code review
Co-authored-by: Marya <111139605+MaryaBelanger@users.noreply.github.com>
1 parent f1c010c commit f7b4941

File tree

1 file changed

+18
-26
lines changed

1 file changed

+18
-26
lines changed

src/content/tools/pub/cmd/pub-token.md

+18-26
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ and [retrieving](pub-get) dependencies.
99

1010
It stores these tokens in a [user-wide config directory][config-dir].
1111

12-
It has three subcommands: `add`, `list` and `remove`.
12+
This command consists of three subcommands: `add`, `list` and `remove`.
1313

14-
Consider a scenario when you have a [dependency](/tools/pub/dependencies)
14+
Consider a scenario where you have a [dependency](/tools/pub/dependencies)
1515
hosted on a private repository.
1616
When you invoke `dart pub get`, the command _might_ return a prompt
1717
to provide credentials:
@@ -25,16 +25,18 @@ https://some-package-repo.com/my-org/my-repo package repository requested authen
2525
Go to https://some-package-repo.com and log in to obtain your token.
2626
```
2727

28-
In this last message, the final line gives you the server that can help you
29-
obtain a token. Not all servers provide such this message.
28+
The server might include a message in the final line of the prompt
29+
to help you obtain a token.
30+
This message is displayed in the previous example.
31+
Not all servers provide this message.
3032

3133
## Add a new credential
3234

33-
To create a new credential, invoke `dart pub token add`.
35+
To add a new credential, run the command `dart pub token add`.
3436

3537
### Add a credential for the current session
3638

37-
At the prompt, type the credential on the command line (`stdin`).
39+
At the prompt, type the credential on the command line.
3840

3941
```console
4042
$ dart pub token add https://some-package-repo.com/my-org/my-repo
@@ -44,45 +46,34 @@ Enter secret token: <Type token on stdin>
4446
```
4547

4648
:::note
47-
The token takes input on `stdin` rather than as a command line option
49+
The token takes input over `stdin` rather than as a command line option
4850
to keep the token out of the shell history.
4951
:::
5052

5153
### Add a credential for all sessions
5254

5355
In a script, you can store the secret in an environment variable.
5456

55-
If you choose to store your secret in an environment variable,
56-
find a way to hide the secret from your shell history.
57-
To explore one way of doing this, consult [this post on Medium][zsh-post].
58-
If you add a local environment variable, you need to restart any open
57+
If you choose to store your token in an environment variable,
58+
[find a way][zsh-post] to hide the token from your shell history.
59+
If you add an environment variable, you need to restart any open
5960
consoles to enable that new variable.
6061

61-
Most CI environments can inject secrets into an environment variable.
62-
To learn how, consult documentation for [GitHub Actions][]] or
62+
Most CI environments can inject tokens into an environment variable.
63+
To learn how, consult documentation for [GitHub Actions][] or
6364
[GitLab][] as examples.
6465

6566
[GitHub Actions]: https://docs.github.com/actions/security-guides/encrypted-secrets#using-encrypted-secrets-in-a-workflow
6667
[GitLab]: https://docs.gitlab.com/ee/ci/secrets/
6768
[zsh-post]: https://medium.com/@prasincs/hiding-secret-keys-from-shell-history-part-1-5875eb5556cc
6869

69-
To use an environment variable as a token, invoke:
7070

71-
```console
72-
dart pub token add <hosted-url> --env-var <ENV_VAR_NAME>
73-
```
7471

75-
This causes `dart pub get` to read the data stored in `$TOKEN_VAR` then
76-
use it as the authentication token.
7772

78-
```console
79-
$ dart pub token add https://other-package-repo.com/ --env-var TOKEN_VAR
80-
Requests to "https://other-package-repo.com/" will now be authenticated using the secret token stored in the environment variable "TOKEN_VAR".
81-
```
8273

8374
## Return a list of credentials
8475

85-
To see a list of all active credentials, invoke `dart pub token list`:
76+
To see a list of all active credentials, run the command `dart pub token list`:
8677

8778
```console
8879
$ dart pub token list
@@ -93,14 +84,15 @@ https://other-package-repo.com/
9384

9485
## Remove one or more credentials
9586

96-
To remove a single token, invoke `dart pub token remove`:
87+
To remove a single token, run the command `dart pub token remove`:
9788

9889
```console
9990
$ dart pub token remove https://other-package-repo.com
10091
Removed secret token for package repository: https://other-package-repo.com
10192
```
10293

103-
To remove all tokens, invoke the command with the `remove --all` option:
94+
To remove all tokens,
95+
run the same command and append the `--all` option:
10496

10597
```console
10698
$ dart pub token remove --all

0 commit comments

Comments
 (0)