npm-token.1 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. .TH "NPM-TOKEN" "1" "March 2026" "NPM@11.12.0" ""
  2. .SH "NAME"
  3. \fBnpm-token\fR - Manage your authentication tokens
  4. .SS "Synopsis"
  5. .P
  6. .RS 2
  7. .nf
  8. npm token list
  9. npm token revoke <id|token>
  10. npm token create
  11. .fi
  12. .RE
  13. .P
  14. Note: This command is unaware of workspaces.
  15. .SS "Description"
  16. .P
  17. This lets you list, create and revoke authentication tokens.
  18. .SS "Listing tokens"
  19. .P
  20. When listing tokens, an abbreviated token will be displayed. For security purposes the full token is not displayed.
  21. .SS "Generating tokens"
  22. .P
  23. When generating tokens, you will be prompted you for your password and, if you have two-factor authentication enabled, an otp.
  24. .P
  25. Please refer to the \fBdocs website\fR \fI\(lahttps://docs.npmjs.com/creating-and-viewing-access-tokens\(ra\fR for more information on generating tokens for CI/CD.
  26. .SS "Revoking tokens"
  27. .P
  28. When revoking a token, you can use the full token (e.g. what you get back from \fBnpm token create\fR, or as can be found in an \fB.npmrc\fR file), or a truncated id. If the given truncated id is not distinct enough to differentiate between multiple existing tokens, you will need to use enough of the id to allow npm to distinguish between them. Full token ids can be found on the \fBnpm website\fR \fI\(lahttps://www.npmjs.com\(ra\fR, or in the \fB--parseable\fR or \fB--json\fR output of \fBnpm token list\fR. This command will NOT accept the truncated token found in the normal \fBnpm token list\fR output.
  29. .P
  30. A revoked token will immediately be removed from the registry and you will no longer be able to use it.
  31. .SS "Configuration"
  32. .SS "\fBname\fR"
  33. .RS 0
  34. .IP \(bu 4
  35. Default: null
  36. .IP \(bu 4
  37. Type: null or String
  38. .RE 0
  39. .P
  40. When creating a Granular Access Token with \fBnpm token create\fR, this sets the name/description for the token.
  41. .SS "\fBtoken-description\fR"
  42. .RS 0
  43. .IP \(bu 4
  44. Default: null
  45. .IP \(bu 4
  46. Type: null or String
  47. .RE 0
  48. .P
  49. Description text for the token when using \fBnpm token create\fR.
  50. .SS "\fBexpires\fR"
  51. .RS 0
  52. .IP \(bu 4
  53. Default: null
  54. .IP \(bu 4
  55. Type: null or Number
  56. .RE 0
  57. .P
  58. When creating a Granular Access Token with \fBnpm token create\fR, this sets the expiration in days. If not specified, the server will determine the default expiration.
  59. .SS "\fBpackages\fR"
  60. .RS 0
  61. .IP \(bu 4
  62. Default:
  63. .IP \(bu 4
  64. Type: null or String (can be set multiple times)
  65. .RE 0
  66. .P
  67. When creating a Granular Access Token with \fBnpm token create\fR, this limits the token access to specific packages.
  68. .SS "\fBpackages-all\fR"
  69. .RS 0
  70. .IP \(bu 4
  71. Default: false
  72. .IP \(bu 4
  73. Type: Boolean
  74. .RE 0
  75. .P
  76. When creating a Granular Access Token with \fBnpm token create\fR, grants the token access to all packages instead of limiting to specific packages.
  77. .SS "\fBscopes\fR"
  78. .RS 0
  79. .IP \(bu 4
  80. Default: null
  81. .IP \(bu 4
  82. Type: null or String (can be set multiple times)
  83. .RE 0
  84. .P
  85. When creating a Granular Access Token with \fBnpm token create\fR, this limits the token access to specific scopes. Provide a scope name (with or without @ prefix).
  86. .SS "\fBorgs\fR"
  87. .RS 0
  88. .IP \(bu 4
  89. Default: null
  90. .IP \(bu 4
  91. Type: null or String (can be set multiple times)
  92. .RE 0
  93. .P
  94. When creating a Granular Access Token with \fBnpm token create\fR, this limits the token access to specific organizations.
  95. .SS "\fBpackages-and-scopes-permission\fR"
  96. .RS 0
  97. .IP \(bu 4
  98. Default: null
  99. .IP \(bu 4
  100. Type: null, "read-only", "read-write", or "no-access"
  101. .RE 0
  102. .P
  103. When creating a Granular Access Token with \fBnpm token create\fR, sets the permission level for packages and scopes. Options are "read-only", "read-write", or "no-access".
  104. .SS "\fBorgs-permission\fR"
  105. .RS 0
  106. .IP \(bu 4
  107. Default: null
  108. .IP \(bu 4
  109. Type: null, "read-only", "read-write", or "no-access"
  110. .RE 0
  111. .P
  112. When creating a Granular Access Token with \fBnpm token create\fR, sets the permission level for organizations. Options are "read-only", "read-write", or "no-access".
  113. .SS "\fBcidr\fR"
  114. .RS 0
  115. .IP \(bu 4
  116. Default: null
  117. .IP \(bu 4
  118. Type: null or String (can be set multiple times)
  119. .RE 0
  120. .P
  121. This is a list of CIDR address to be used when configuring limited access tokens with the \fBnpm token create\fR command.
  122. .SS "\fBbypass-2fa\fR"
  123. .RS 0
  124. .IP \(bu 4
  125. Default: false
  126. .IP \(bu 4
  127. Type: Boolean
  128. .RE 0
  129. .P
  130. When creating a Granular Access Token with \fBnpm token create\fR, setting this to true will allow the token to bypass two-factor authentication. This is useful for automation and CI/CD workflows.
  131. .SS "\fBpassword\fR"
  132. .RS 0
  133. .IP \(bu 4
  134. Default: null
  135. .IP \(bu 4
  136. Type: null or String
  137. .RE 0
  138. .P
  139. Password for authentication. Can be provided via command line when creating tokens, though it's generally safer to be prompted for it.
  140. .SS "\fBregistry\fR"
  141. .RS 0
  142. .IP \(bu 4
  143. Default: "https://registry.npmjs.org/"
  144. .IP \(bu 4
  145. Type: URL
  146. .RE 0
  147. .P
  148. The base URL of the npm registry.
  149. .SS "\fBotp\fR"
  150. .RS 0
  151. .IP \(bu 4
  152. Default: null
  153. .IP \(bu 4
  154. Type: null or String
  155. .RE 0
  156. .P
  157. This is a one-time password from a two-factor authenticator. It's needed when publishing or changing package permissions with \fBnpm access\fR.
  158. .P
  159. 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.
  160. .SS "\fBread-only\fR"
  161. .RS 0
  162. .IP \(bu 4
  163. Default: false
  164. .IP \(bu 4
  165. Type: Boolean
  166. .RE 0
  167. .P
  168. This is used to mark a token as unable to publish when configuring limited access tokens with the \fBnpm token create\fR command.
  169. .SS "See Also"
  170. .RS 0
  171. .IP \(bu 4
  172. npm help adduser
  173. .IP \(bu 4
  174. npm help registry
  175. .IP \(bu 4
  176. npm help config
  177. .IP \(bu 4
  178. npm help npmrc
  179. .IP \(bu 4
  180. npm help owner
  181. .IP \(bu 4
  182. npm help whoami
  183. .IP \(bu 4
  184. npm help profile
  185. .RE 0