main
@reggi/path-to-regexp
dependabot/npm_and_yarn/main/copy-to-clipboard-4.0.2
dependabot/npm_and_yarn/main/eslint-10.4.0
dependabot/npm_and_yarn/main/npmcli/eslint-config-7.0.0
dependabot/npm_and_yarn/main/proc-log-7.0.0
dependabot/npm_and_yarn/npm_and_yarn-826852524d
dependabot/npm_and_yarn/npm_and_yarn-ab9a7f4bc2
deprecate-totp-2fa
dhei/classic-tokens
gat-bypass-2fa-docs
jpg619/fix-accessibility-content-flow
jpg619/version-bump-tar-2
kartykp/gat-bypass-2fa-docs
kartykp/upgrade-path-to-regex
main
maitxn/version-bump-tar
patch-1
reggi/cache-based-on-version
reggi/dev-engines
reggi/fix-transform-prettier
reggi/overrides
update-search-sensitivity
| 1 | --- |
| 2 | title: npm-token |
| 3 | section: 1 |
| 4 | description: Manage your authentication tokens |
| 5 | github_repo: npm/cli |
| 6 | github_branch: release/v10 |
| 7 | github_path: docs/lib/content/commands/npm-token.md |
| 8 | redirect_from: |
| 9 | - /cli-documentation/v10/cli-commands/npm-token |
| 10 | - /cli-documentation/v10/cli-commands/token |
| 11 | - /cli-documentation/v10/commands/npm-token |
| 12 | - /cli-documentation/v10/commands/token |
| 13 | - /cli-documentation/v10/npm-token |
| 14 | - /cli-documentation/v10/token |
| 15 | - /cli/v10/cli-commands/npm-token |
| 16 | - /cli/v10/cli-commands/token |
| 17 | - /cli/v10/commands/token |
| 18 | - /cli/v10/npm-token |
| 19 | - /cli/v10/token |
| 20 | --- |
| 21 | |
| 22 | ### Synopsis |
| 23 | |
| 24 | ```bash |
| 25 | npm token list |
| 26 | npm token revoke <id|token> |
| 27 | npm token create [--read-only] [--cidr=list] |
| 28 | ``` |
| 29 | |
| 30 | Note: This command is unaware of workspaces. |
| 31 | |
| 32 | ### Description |
| 33 | |
| 34 | This lets you list, create and revoke authentication tokens. |
| 35 | |
| 36 | - `npm token list`: Shows a table of all active authentication tokens. You can request this as JSON with `--json` or tab-separated values with `--parseable`. |
| 37 | |
| 38 | ``` |
| 39 | Read only token npm_1f… with id 7f3134 created 2017-10-21 |
| 40 | |
| 41 | Publish token npm_af… with id c03241 created 2017-10-02 |
| 42 | with IP Whitelist: 192.168.0.1/24 |
| 43 | |
| 44 | Publish token npm_… with id e0cf92 created 2017-10-02 |
| 45 | |
| 46 | ``` |
| 47 | |
| 48 | - `npm token create [--read-only] [--cidr=<cidr-ranges>]`: Create a new authentication token. It can be `--read-only`, or accept a list of [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) ranges with which to limit use of this token. This will prompt you for your password, and, if you have two-factor authentication enabled, an otp. |
| 49 | |
| 50 | Currently, the cli can not generate automation tokens. Please refer to the [docs website](https://docs.npmjs.com/creating-and-viewing-access-tokens) for more information on generating automation tokens. |
| 51 | |
| 52 | ``` |
| 53 | Created publish token a73c9572-f1b9-8983-983d-ba3ac3cc913d |
| 54 | ``` |
| 55 | |
| 56 | - `npm token revoke <token|id>`: Immediately removes an authentication token from the registry. You will no longer be able to use it. This can accept both complete tokens (such as those you get back from `npm token create`, and those found in your `.npmrc`), and ids as seen in the parseable or json output of `npm token list`. This will NOT accept the truncated token found in the normal `npm token list` output. |
| 57 | |
| 58 | ### Configuration |
| 59 | |
| 60 | #### `read-only` |
| 61 | |
| 62 | - Default: false |
| 63 | - Type: Boolean |
| 64 | |
| 65 | This is used to mark a token as unable to publish when configuring limited access tokens with the `npm token create` command. |
| 66 | |
| 67 | #### `cidr` |
| 68 | |
| 69 | - Default: null |
| 70 | - Type: null or String (can be set multiple times) |
| 71 | |
| 72 | This is a list of CIDR address to be used when configuring limited access tokens with the `npm token create` command. |
| 73 | |
| 74 | #### `registry` |
| 75 | |
| 76 | - Default: "https://registry.npmjs.org/" |
| 77 | - Type: URL |
| 78 | |
| 79 | The base URL of the npm registry. |
| 80 | |
| 81 | #### `otp` |
| 82 | |
| 83 | - Default: null |
| 84 | - Type: null or String |
| 85 | |
| 86 | This is a one-time password from a two-factor authenticator. It's needed when publishing or changing package permissions with `npm access`. |
| 87 | |
| 88 | If not set, and a registry response fails with a challenge for a one-time password, npm will prompt on the command line for one. |
| 89 | |
| 90 | ### See Also |
| 91 | |
| 92 | - [npm adduser](/cli/v10/commands/npm-adduser) |
| 93 | - [npm registry](/cli/v10/using-npm/registry) |
| 94 | - [npm config](/cli/v10/commands/npm-config) |
| 95 | - [npmrc](/cli/v10/configuring-npm/npmrc) |
| 96 | - [npm owner](/cli/v10/commands/npm-owner) |
| 97 | - [npm whoami](/cli/v10/commands/npm-whoami) |
| 98 | - [npm profile](/cli/v10/commands/npm-profile) |