11cb0ef41Sopenharmony_ci--- 21cb0ef41Sopenharmony_cititle: npm-token 31cb0ef41Sopenharmony_cisection: 1 41cb0ef41Sopenharmony_cidescription: Manage your authentication tokens 51cb0ef41Sopenharmony_ci--- 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ci### Synopsis 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ci```bash 101cb0ef41Sopenharmony_cinpm token list 111cb0ef41Sopenharmony_cinpm token revoke <id|token> 121cb0ef41Sopenharmony_cinpm token create [--read-only] [--cidr=list] 131cb0ef41Sopenharmony_ci``` 141cb0ef41Sopenharmony_ci 151cb0ef41Sopenharmony_ciNote: This command is unaware of workspaces. 161cb0ef41Sopenharmony_ci 171cb0ef41Sopenharmony_ci### Description 181cb0ef41Sopenharmony_ci 191cb0ef41Sopenharmony_ciThis lets you list, create and revoke authentication tokens. 201cb0ef41Sopenharmony_ci 211cb0ef41Sopenharmony_ci* `npm token list`: 221cb0ef41Sopenharmony_ci Shows a table of all active authentication tokens. You can request 231cb0ef41Sopenharmony_ci this as JSON with `--json` or tab-separated values with `--parseable`. 241cb0ef41Sopenharmony_ci 251cb0ef41Sopenharmony_ci```bash 261cb0ef41Sopenharmony_ci+--------+---------+------------+----------+----------------+ 271cb0ef41Sopenharmony_ci| id | token | created | read-only | CIDR whitelist | 281cb0ef41Sopenharmony_ci+--------+---------+------------+----------+----------------+ 291cb0ef41Sopenharmony_ci| 7f3134 | 1fa9ba… | 2017-10-02 | yes | | 301cb0ef41Sopenharmony_ci+--------+---------+------------+----------+----------------+ 311cb0ef41Sopenharmony_ci| c03241 | af7aef… | 2017-10-02 | no | 192.168.0.1/24 | 321cb0ef41Sopenharmony_ci+--------+---------+------------+----------+----------------+ 331cb0ef41Sopenharmony_ci| e0cf92 | 3a436a… | 2017-10-02 | no | | 341cb0ef41Sopenharmony_ci+--------+---------+------------+----------+----------------+ 351cb0ef41Sopenharmony_ci| 63eb9d | 74ef35… | 2017-09-28 | no | | 361cb0ef41Sopenharmony_ci+--------+---------+------------+----------+----------------+ 371cb0ef41Sopenharmony_ci| 2daaa8 | cbad5f… | 2017-09-26 | no | | 381cb0ef41Sopenharmony_ci+--------+---------+------------+----------+----------------+ 391cb0ef41Sopenharmony_ci| 68c2fe | 127e51… | 2017-09-23 | no | | 401cb0ef41Sopenharmony_ci+--------+---------+------------+----------+----------------+ 411cb0ef41Sopenharmony_ci| 6334e1 | 1dadd1… | 2017-09-23 | no | | 421cb0ef41Sopenharmony_ci+--------+---------+------------+----------+----------------+ 431cb0ef41Sopenharmony_ci``` 441cb0ef41Sopenharmony_ci 451cb0ef41Sopenharmony_ci* `npm token create [--read-only] [--cidr=<cidr-ranges>]`: 461cb0ef41Sopenharmony_ci Create a new authentication token. It can be `--read-only`, or accept 471cb0ef41Sopenharmony_ci a list of 481cb0ef41Sopenharmony_ci [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) 491cb0ef41Sopenharmony_ci ranges with which to limit use of this token. This will prompt you for 501cb0ef41Sopenharmony_ci your password, and, if you have two-factor authentication enabled, an 511cb0ef41Sopenharmony_ci otp. 521cb0ef41Sopenharmony_ci 531cb0ef41Sopenharmony_ci Currently, the cli can not generate automation tokens. Please refer to 541cb0ef41Sopenharmony_ci the [docs 551cb0ef41Sopenharmony_ci website](https://docs.npmjs.com/creating-and-viewing-access-tokens) 561cb0ef41Sopenharmony_ci for more information on generating automation tokens. 571cb0ef41Sopenharmony_ci 581cb0ef41Sopenharmony_ci```bash 591cb0ef41Sopenharmony_ci+----------------+--------------------------------------+ 601cb0ef41Sopenharmony_ci| token | a73c9572-f1b9-8983-983d-ba3ac3cc913d | 611cb0ef41Sopenharmony_ci+----------------+--------------------------------------+ 621cb0ef41Sopenharmony_ci| cidr_whitelist | | 631cb0ef41Sopenharmony_ci+----------------+--------------------------------------+ 641cb0ef41Sopenharmony_ci| readonly | false | 651cb0ef41Sopenharmony_ci+----------------+--------------------------------------+ 661cb0ef41Sopenharmony_ci| created | 2017-10-02T07:52:24.838Z | 671cb0ef41Sopenharmony_ci+----------------+--------------------------------------+ 681cb0ef41Sopenharmony_ci``` 691cb0ef41Sopenharmony_ci 701cb0ef41Sopenharmony_ci* `npm token revoke <token|id>`: 711cb0ef41Sopenharmony_ci Immediately removes an authentication token from the registry. You 721cb0ef41Sopenharmony_ci will no longer be able to use it. This can accept both complete 731cb0ef41Sopenharmony_ci tokens (such as those you get back from `npm token create`, and those 741cb0ef41Sopenharmony_ci found in your `.npmrc`), and ids as seen in the parseable or json 751cb0ef41Sopenharmony_ci output of `npm token list`. This will NOT accept the truncated token 761cb0ef41Sopenharmony_ci found in the normal `npm token list` output. 771cb0ef41Sopenharmony_ci 781cb0ef41Sopenharmony_ci### Configuration 791cb0ef41Sopenharmony_ci 801cb0ef41Sopenharmony_ci#### `read-only` 811cb0ef41Sopenharmony_ci 821cb0ef41Sopenharmony_ci* Default: false 831cb0ef41Sopenharmony_ci* Type: Boolean 841cb0ef41Sopenharmony_ci 851cb0ef41Sopenharmony_ciThis is used to mark a token as unable to publish when configuring limited 861cb0ef41Sopenharmony_ciaccess tokens with the `npm token create` command. 871cb0ef41Sopenharmony_ci 881cb0ef41Sopenharmony_ci 891cb0ef41Sopenharmony_ci 901cb0ef41Sopenharmony_ci#### `cidr` 911cb0ef41Sopenharmony_ci 921cb0ef41Sopenharmony_ci* Default: null 931cb0ef41Sopenharmony_ci* Type: null or String (can be set multiple times) 941cb0ef41Sopenharmony_ci 951cb0ef41Sopenharmony_ciThis is a list of CIDR address to be used when configuring limited access 961cb0ef41Sopenharmony_citokens with the `npm token create` command. 971cb0ef41Sopenharmony_ci 981cb0ef41Sopenharmony_ci 991cb0ef41Sopenharmony_ci 1001cb0ef41Sopenharmony_ci#### `registry` 1011cb0ef41Sopenharmony_ci 1021cb0ef41Sopenharmony_ci* Default: "https://registry.npmjs.org/" 1031cb0ef41Sopenharmony_ci* Type: URL 1041cb0ef41Sopenharmony_ci 1051cb0ef41Sopenharmony_ciThe base URL of the npm registry. 1061cb0ef41Sopenharmony_ci 1071cb0ef41Sopenharmony_ci 1081cb0ef41Sopenharmony_ci 1091cb0ef41Sopenharmony_ci#### `otp` 1101cb0ef41Sopenharmony_ci 1111cb0ef41Sopenharmony_ci* Default: null 1121cb0ef41Sopenharmony_ci* Type: null or String 1131cb0ef41Sopenharmony_ci 1141cb0ef41Sopenharmony_ciThis is a one-time password from a two-factor authenticator. It's needed 1151cb0ef41Sopenharmony_ciwhen publishing or changing package permissions with `npm access`. 1161cb0ef41Sopenharmony_ci 1171cb0ef41Sopenharmony_ciIf not set, and a registry response fails with a challenge for a one-time 1181cb0ef41Sopenharmony_cipassword, npm will prompt on the command line for one. 1191cb0ef41Sopenharmony_ci 1201cb0ef41Sopenharmony_ci 1211cb0ef41Sopenharmony_ci 1221cb0ef41Sopenharmony_ci### See Also 1231cb0ef41Sopenharmony_ci 1241cb0ef41Sopenharmony_ci* [npm adduser](/commands/npm-adduser) 1251cb0ef41Sopenharmony_ci* [npm registry](/using-npm/registry) 1261cb0ef41Sopenharmony_ci* [npm config](/commands/npm-config) 1271cb0ef41Sopenharmony_ci* [npmrc](/configuring-npm/npmrc) 1281cb0ef41Sopenharmony_ci* [npm owner](/commands/npm-owner) 1291cb0ef41Sopenharmony_ci* [npm whoami](/commands/npm-whoami) 1301cb0ef41Sopenharmony_ci* [npm profile](/commands/npm-profile) 131