2025-04-10 14:36:22 -07:00
.TH "NPM-TOKEN" "1" "April 2025" "NPM@11.3.0" ""
2020-01-28 17:14:59 -05:00
.SH "NAME"
2022-12-06 22:18:33 -05:00
\fB npm-token\fR - Manage your authentication tokens
.SS "Synopsis"
2017-10-26 22:35:25 -04:00
.P
2020-01-28 17:14:59 -05:00
.RS 2
.nf
2022-02-24 21:41:49 +00:00
npm token list
npm token revoke <id|token>
2022-12-06 22:18:33 -05:00
npm token create \[ lB]--read-only\[ rB] \[ lB]--cidr=list\[ rB]
2020-01-28 17:14:59 -05:00
.fi
.RE
2021-03-23 14:58:11 -04:00
.P
2022-12-06 22:18:33 -05:00
Note: This command is unaware of workspaces.
.SS "Description"
2020-01-28 17:14:59 -05:00
.P
2022-12-06 22:18:33 -05:00
This lets you list, create and revoke authentication tokens.
2020-01-28 17:14:59 -05:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
\fB npm token list\fR : Shows a table of all active authentication tokens. You can request this as JSON with \fB --json\fR or tab-separated values with \fB --parseable\fR .
.RE 0
2020-01-28 17:14:59 -05:00
.P
.RS 2
.nf
2024-04-30 23:53:22 -07:00
Read only token npm_1f… with id 7f3134 created 2017-10-21
Publish token npm_af… with id c03241 created 2017-10-02
with IP Whitelist: 192.168.0.1/24
Publish token npm_… with id e0cf92 created 2017-10-02
2020-01-28 17:14:59 -05:00
.fi
.RE
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
\fB npm token create \[ lB]--read-only\[ rB] \[ lB]--cidr=<cidr-ranges>\[ rB]\fR : Create a new authentication token. It can be \fB --read-only\fR , or accept a list of \fB CIDR\fR \fI \(la https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing\(ra \fR 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.
.P
Currently, the cli can not generate automation tokens. Please refer to the \fB docs website\fR \fI \(la https://docs.npmjs.com/creating-and-viewing-access-tokens\(ra \fR for more information on generating automation tokens.
.RE 0
2020-01-28 17:14:59 -05:00
.P
.RS 2
.nf
2024-04-30 23:53:22 -07:00
Created publish token a73c9572-f1b9-8983-983d-ba3ac3cc913d
2020-01-28 17:14:59 -05:00
.fi
.RE
2017-10-26 22:35:25 -04:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
\fB npm token revoke <token|id>\fR : 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 \fB npm token create\fR , and those found in your \fB .npmrc\fR ), and ids as seen in the parseable or json output of \fB npm token list\fR . This will NOT accept the truncated token found in the normal \fB npm token list\fR output.
.RE 0
2017-10-26 22:35:25 -04:00
2022-12-06 22:18:33 -05:00
.SS "Configuration"
.SS "\fBread-only\fR"
2021-05-20 15:54:50 -04:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-05-20 15:54:50 -04:00
Default: false
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-05-20 15:54:50 -04:00
Type: Boolean
2022-12-06 22:18:33 -05:00
.RE 0
2021-05-20 15:54:50 -04:00
.P
2022-12-06 22:18:33 -05:00
This is used to mark a token as unable to publish when configuring limited access tokens with the \fB npm token create\fR command.
.SS "\fBcidr\fR"
2021-05-20 15:54:50 -04:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-05-20 15:54:50 -04:00
Default: null
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-05-20 15:54:50 -04:00
Type: null or String (can be set multiple times)
2022-12-06 22:18:33 -05:00
.RE 0
2021-05-20 15:54:50 -04:00
.P
2022-12-06 22:18:33 -05:00
This is a list of CIDR address to be used when configuring limited access tokens with the \fB npm token create\fR command.
.SS "\fBregistry\fR"
2021-05-20 15:54:50 -04:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
Default: "https://registry.npmjs.org/"
.IP \(bu 4
2021-05-20 15:54:50 -04:00
Type: URL
2022-12-06 22:18:33 -05:00
.RE 0
2021-05-20 15:54:50 -04:00
.P
2022-12-06 22:18:33 -05:00
The base URL of the npm registry.
.SS "\fBotp\fR"
2021-05-20 15:54:50 -04:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-05-20 15:54:50 -04:00
Default: null
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-05-20 15:54:50 -04:00
Type: null or String
2022-12-06 22:18:33 -05:00
.RE 0
2021-05-20 15:54:50 -04:00
.P
2022-12-06 22:18:33 -05:00
This is a one-time password from a two-factor authenticator. It's needed when publishing or changing package permissions with \fB npm access\fR .
2021-05-20 15:54:50 -04:00
.P
2022-12-06 22:18:33 -05:00
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.
.SS "See Also"
2021-05-20 15:54:50 -04:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-05-20 15:54:50 -04:00
npm help adduser
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-05-20 15:54:50 -04:00
npm help registry
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-05-20 15:54:50 -04:00
npm help config
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-05-20 15:54:50 -04:00
npm help npmrc
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-05-20 15:54:50 -04:00
npm help owner
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-05-20 15:54:50 -04:00
npm help whoami
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-05-20 15:54:50 -04:00
npm help profile
2022-12-06 22:18:33 -05:00
.RE 0