codekingpro/portable-devtools
114k
1<!DOCTYPE html><html><head>
2<meta charset="utf-8">
3<title>npm-token</title>
4<style>
5body {
6 background-color: #ffffff;
7 color: #24292e;
8
9 margin: 0;
10
11 line-height: 1.5;
12
13 font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
14}
15#rainbar {
16 height: 10px;
17 background-image: linear-gradient(139deg, #fb8817, #ff4b01, #c12127, #e02aff);
18}
19
20a {
21 text-decoration: none;
22 color: #0366d6;
23}
24a:hover {
25 text-decoration: underline;
26}
27
28pre {
29 margin: 1em 0px;
30 padding: 1em;
31 border: solid 1px #e1e4e8;
32 border-radius: 6px;
33
34 display: block;
35 overflow: auto;
36
37 white-space: pre;
38
39 background-color: #f6f8fa;
40 color: #393a34;
41}
42code {
43 font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace;
44 font-size: 85%;
45 padding: 0.2em 0.4em;
46 background-color: #f6f8fa;
47 color: #393a34;
48}
49pre > code {
50 padding: 0;
51 background-color: inherit;
52 color: inherit;
53}
54h1, h2, h3 {
55 font-weight: 600;
56}
57
58#logobar {
59 background-color: #333333;
60 margin: 0 auto;
61 padding: 1em 4em;
62}
63#logobar .logo {
64 float: left;
65}
66#logobar .title {
67 font-weight: 600;
68 color: #dddddd;
69 float: left;
70 margin: 5px 0 0 1em;
71}
72#logobar:after {
73 content: "";
74 display: block;
75 clear: both;
76}
77
78#content {
79 margin: 0 auto;
80 padding: 0 4em;
81}
82
83#table_of_contents > h2 {
84 font-size: 1.17em;
85}
86#table_of_contents ul:first-child {
87 border: solid 1px #e1e4e8;
88 border-radius: 6px;
89 padding: 1em;
90 background-color: #f6f8fa;
91 color: #393a34;
92}
93#table_of_contents ul {
94 list-style-type: none;
95 padding-left: 1.5em;
96}
97#table_of_contents li {
98 font-size: 0.9em;
99}
100#table_of_contents li a {
101 color: #000000;
102}
103
104header.title {
105 border-bottom: solid 1px #e1e4e8;
106}
107header.title > h1 {
108 margin-bottom: 0.25em;
109}
110header.title > .description {
111 display: block;
112 margin-bottom: 0.5em;
113 line-height: 1;
114}
115
116header.title .version {
117 font-size: 0.8em;
118 color: #666666;
119}
120
121footer#edit {
122 border-top: solid 1px #e1e4e8;
123 margin: 3em 0 4em 0;
124 padding-top: 2em;
125}
126
127table {
128 width: 100%;
129 margin: 1em 0;
130 border-radius: 6px;
131 border: 1px solid #e1e4e8;
132 overflow: hidden;
133 border-collapse: separate;
134 border-spacing: 0;
135}
136
137table thead {
138 background-color: #f6f8fa;
139}
140
141table tbody {
142 background-color: #ffffff;
143}
144
145table th,
146table td {
147 padding: 0.75em;
148 text-align: left;
149 border-right: 1px solid #e1e4e8;
150 border-bottom: 1px solid #e1e4e8;
151}
152
153table th:last-child,
154table td:last-child {
155 border-right: none;
156}
157
158table tbody tr:last-child td {
159 border-bottom: none;
160}
161
162table th {
163 font-weight: 600;
164 background-color: #f6f8fa;
165}
166
167table code {
168 white-space: nowrap;
169}
170
171</style>
172</head>
173<body>
174<div id="banner">
175<div id="rainbar"></div>
176<div id="logobar">
177<svg class="logo" role="img" height="32" width="32" viewBox="0 0 700 700">
178<polygon fill="#cb0000" points="0,700 700,700 700,0 0,0"></polygon>
179<polygon fill="#ffffff" points="150,550 350,550 350,250 450,250 450,550 550,550 550,150 150,150"></polygon>
180</svg>
181<div class="title">
182npm command-line interface
183</div>
184</div>
185</div>
186
187<section id="content">
188<header class="title">
189<h1 id="----npm-token----11130">
190 <span>npm-token</span>
191 <span class="version">@11.13.0</span>
192</h1>
193<span class="description">Manage your authentication tokens</span>
194</header>
195
196<section id="table_of_contents">
197<h2 id="table-of-contents">Table of contents</h2>
198<div id="_table_of_contents"><ul><li><a href="#synopsis">Synopsis</a></li><li><a href="#description">Description</a></li><ul><li><a href="#listing-tokens">Listing tokens</a></li><li><a href="#generating-tokens">Generating tokens</a></li><li><a href="#revoking-tokens">Revoking tokens</a></li></ul><li><a href="#configuration">Configuration</a></li><ul><li><a href="#name"><code>name</code></a></li><li><a href="#token-description"><code>token-description</code></a></li><li><a href="#expires"><code>expires</code></a></li><li><a href="#packages"><code>packages</code></a></li><li><a href="#packages-all"><code>packages-all</code></a></li><li><a href="#scopes"><code>scopes</code></a></li><li><a href="#orgs"><code>orgs</code></a></li><li><a href="#packages-and-scopes-permission"><code>packages-and-scopes-permission</code></a></li><li><a href="#orgs-permission"><code>orgs-permission</code></a></li><li><a href="#cidr"><code>cidr</code></a></li><li><a href="#bypass-2fa"><code>bypass-2fa</code></a></li><li><a href="#password"><code>password</code></a></li><li><a href="#registry"><code>registry</code></a></li><li><a href="#otp"><code>otp</code></a></li><li><a href="#read-only"><code>read-only</code></a></li></ul><li><a href="#see-also">See Also</a></li></ul></div>
199</section>
200
201<div id="_content"><h3 id="synopsis">Synopsis</h3>
202<pre><code class="language-bash">npm token list
203npm token revoke <id|token>
204npm token create
205</code></pre>
206<p>Note: This command is unaware of workspaces.</p>
207<h3 id="description">Description</h3>
208<p>This lets you list, create and revoke authentication tokens.</p>
209<h4 id="listing-tokens">Listing tokens</h4>
210<p>When listing tokens, an abbreviated token will be displayed. For security purposes the full token is not displayed.</p>
211<h4 id="generating-tokens">Generating tokens</h4>
212<p>When generating tokens, you will be prompted you for your password and, if you have two-factor authentication enabled, an otp.</p>
213<p>Please refer to the <a href="https://docs.npmjs.com/creating-and-viewing-access-tokens">docs website</a> for more information on generating tokens for CI/CD.</p>
214<h4 id="revoking-tokens">Revoking tokens</h4>
215<p>When revoking a token, you can use the full token (e.g. what you get back from <code>npm token create</code>, or as can be found in an <code>.npmrc</code> 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 <a href="https://www.npmjs.com">npm website</a>, or in the <code>--parseable</code> or <code>--json</code> output of <code>npm token list</code>. This command will NOT accept the truncated token found in the normal <code>npm token list</code> output.</p>
216<p>A revoked token will immediately be removed from the registry and you will no longer be able to use it.</p>
217<h3 id="configuration">Configuration</h3>
218<h4 id="name"><code>name</code></h4>
219<ul>
220<li>Default: null</li>
221<li>Type: null or String</li>
222</ul>
223<p>When creating a Granular Access Token with <code>npm token create</code>, this sets the
224name/description for the token.</p>
225<h4 id="token-description"><code>token-description</code></h4>
226<ul>
227<li>Default: null</li>
228<li>Type: null or String</li>
229</ul>
230<p>Description text for the token when using <code>npm token create</code>.</p>
231<h4 id="expires"><code>expires</code></h4>
232<ul>
233<li>Default: null</li>
234<li>Type: null or Number</li>
235</ul>
236<p>When creating a Granular Access Token with <code>npm token create</code>, this sets the
237expiration in days. If not specified, the server will determine the default
238expiration.</p>
239<h4 id="packages"><code>packages</code></h4>
240<ul>
241<li>Default:</li>
242<li>Type: null or String (can be set multiple times)</li>
243</ul>
244<p>When creating a Granular Access Token with <code>npm token create</code>, this limits
245the token access to specific packages.</p>
246<h4 id="packages-all"><code>packages-all</code></h4>
247<ul>
248<li>Default: false</li>
249<li>Type: Boolean</li>
250</ul>
251<p>When creating a Granular Access Token with <code>npm token create</code>, grants the
252token access to all packages instead of limiting to specific packages.</p>
253<h4 id="scopes"><code>scopes</code></h4>
254<ul>
255<li>Default: null</li>
256<li>Type: null or String (can be set multiple times)</li>
257</ul>
258<p>When creating a Granular Access Token with <code>npm token create</code>, this limits
259the token access to specific scopes. Provide a scope name (with or without @
260prefix).</p>
261<h4 id="orgs"><code>orgs</code></h4>
262<ul>
263<li>Default: null</li>
264<li>Type: null or String (can be set multiple times)</li>
265</ul>
266<p>When creating a Granular Access Token with <code>npm token create</code>, this limits
267the token access to specific organizations.</p>
268<h4 id="packages-and-scopes-permission"><code>packages-and-scopes-permission</code></h4>
269<ul>
270<li>Default: null</li>
271<li>Type: null, "read-only", "read-write", or "no-access"</li>
272</ul>
273<p>When creating a Granular Access Token with <code>npm token create</code>, sets the
274permission level for packages and scopes. Options are "read-only",
275"read-write", or "no-access".</p>
276<h4 id="orgs-permission"><code>orgs-permission</code></h4>
277<ul>
278<li>Default: null</li>
279<li>Type: null, "read-only", "read-write", or "no-access"</li>
280</ul>
281<p>When creating a Granular Access Token with <code>npm token create</code>, sets the
282permission level for organizations. Options are "read-only", "read-write",
283or "no-access".</p>
284<h4 id="cidr"><code>cidr</code></h4>
285<ul>
286<li>Default: null</li>
287<li>Type: null or String (can be set multiple times)</li>
288</ul>
289<p>This is a list of CIDR address to be used when configuring limited access
290tokens with the <code>npm token create</code> command.</p>
291<h4 id="bypass-2fa"><code>bypass-2fa</code></h4>
292<ul>
293<li>Default: false</li>
294<li>Type: Boolean</li>
295</ul>
296<p>When creating a Granular Access Token with <code>npm token create</code>, setting this
297to true will allow the token to bypass two-factor authentication. This is
298useful for automation and CI/CD workflows.</p>
299<h4 id="password"><code>password</code></h4>
300<ul>
301<li>Default: null</li>
302<li>Type: null or String</li>
303</ul>
304<p>Password for authentication. Can be provided via command line when creating
305tokens, though it's generally safer to be prompted for it.</p>
306<h4 id="registry"><code>registry</code></h4>
307<ul>
308<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
309<li>Type: URL</li>
310</ul>
311<p>The base URL of the npm registry.</p>
312<h4 id="otp"><code>otp</code></h4>
313<ul>
314<li>Default: null</li>
315<li>Type: null or String</li>
316</ul>
317<p>This is a one-time password from a two-factor authenticator. It's needed
318when publishing or changing package permissions with <code>npm access</code>.</p>
319<p>If not set, and a registry response fails with a challenge for a one-time
320password, npm will prompt on the command line for one.</p>
321<h4 id="read-only"><code>read-only</code></h4>
322<ul>
323<li>Default: false</li>
324<li>Type: Boolean</li>
325</ul>
326<p>This is used to mark a token as unable to publish when configuring limited
327access tokens with the <code>npm token create</code> command.</p>
328<h3 id="see-also">See Also</h3>
329<ul>
330<li><a href="../commands/npm-adduser.html">npm adduser</a></li>
331<li><a href="../using-npm/registry.html">npm registry</a></li>
332<li><a href="../commands/npm-config.html">npm config</a></li>
333<li><a href="../configuring-npm/npmrc.html">npmrc</a></li>
334<li><a href="../commands/npm-owner.html">npm owner</a></li>
335<li><a href="../commands/npm-whoami.html">npm whoami</a></li>
336<li><a href="../commands/npm-profile.html">npm profile</a></li>
337</ul></div>
338
339<footer id="edit">
340<a href="https://github.com/npm/cli/edit/latest/docs/lib/content/commands/npm-token.md">
341<svg role="img" viewBox="0 0 16 16" width="16" height="16" fill="currentcolor" style="vertical-align: text-bottom; margin-right: 0.3em;">
342<path fill-rule="evenodd" d="M11.013 1.427a1.75 1.75 0 012.474 0l1.086 1.086a1.75 1.75 0 010 2.474l-8.61 8.61c-.21.21-.47.364-.756.445l-3.251.93a.75.75 0 01-.927-.928l.929-3.25a1.75 1.75 0 01.445-.758l8.61-8.61zm1.414 1.06a.25.25 0 00-.354 0L10.811 3.75l1.439 1.44 1.263-1.263a.25.25 0 000-.354l-1.086-1.086zM11.189 6.25L9.75 4.81l-6.286 6.287a.25.25 0 00-.064.108l-.558 1.953 1.953-.558a.249.249 0 00.108-.064l6.286-6.286z"></path>
343</svg>
344Edit this page on GitHub
345</a>
346</footer>
347</section>
348
349
350
351</body></html>