npm-token

管理你的身份验证令牌

选择 CLI 版本:

概要

¥Synopsis

npm token list
npm token revoke <id|token>
npm token create [--read-only] [--cidr=list]

注意:此命令对工作区无感知。

¥Note: This command is unaware of workspaces.

描述

¥Description

这使你可以列出、创建和撤销身份验证令牌。

¥This lets you list, create and revoke authentication tokens.

  • npm token list:显示所有活动身份验证令牌的表格。你可以将其请求为带有 --json 的 JSON 或带有 --parseable 的制表符分隔值。

    ¥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.

+--------+---------+------------+----------+----------------+
| id | token | created | read-only | CIDR whitelist |
+--------+---------+------------+----------+----------------+
| 7f3134 | 1fa9ba… | 2017-10-02 | yes | |
+--------+---------+------------+----------+----------------+
| c03241 | af7aef… | 2017-10-02 | no | 192.168.0.1/24 |
+--------+---------+------------+----------+----------------+
| e0cf92 | 3a436a… | 2017-10-02 | no | |
+--------+---------+------------+----------+----------------+
| 63eb9d | 74ef35… | 2017-09-28 | no | |
+--------+---------+------------+----------+----------------+
| 2daaa8 | cbad5f… | 2017-09-26 | no | |
+--------+---------+------------+----------+----------------+
| 68c2fe | 127e51… | 2017-09-23 | no | |
+--------+---------+------------+----------+----------------+
| 6334e1 | 1dadd1… | 2017-09-23 | no | |
+--------+---------+------------+----------+----------------+
  • npm token create [--read-only] [--cidr=<cidr-ranges>]:创建一个新的身份验证令牌。它可以是 --read-only,或者接受 CIDR 范围的列表,以限制使用此令牌。这将提示你输入密码,如果你启用了双重身份验证,则会提示你输入密码。

    ¥npm token create [--read-only] [--cidr=<cidr-ranges>]: Create a new authentication token. It can be --read-only, or accept a list of CIDR 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.

    目前,cli 无法生成自动化令牌。有关生成自动化令牌的更多信息,请参阅 文档网站

    ¥Currently, the cli can not generate automation tokens. Please refer to the docs website for more information on generating automation tokens.

+----------------+--------------------------------------+
| token | a73c9572-f1b9-8983-983d-ba3ac3cc913d |
+----------------+--------------------------------------+
| cidr_whitelist | |
+----------------+--------------------------------------+
| readonly | false |
+----------------+--------------------------------------+
| created | 2017-10-02T07:52:24.838Z |
+----------------+--------------------------------------+
  • npm token revoke <token|id>:立即从注册表中删除身份验证令牌。你将无法再使用它。这可以接受完整的令牌(例如你从 npm token create 返回的令牌,以及在你的 .npmrc 中找到的令牌),以及在 npm token list 的可解析或 json 输出中看到的 id。这将不接受在正常 npm token list 输出中找到的截断标记。

    ¥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.

配置

¥Configuration

read-only

  • 默认值:false

    ¥Default: false

  • 类型:布尔值

    ¥Type: Boolean

这用于在使用 npm token create 命令配置受限访问令牌时将令牌标记为无法发布。

¥This is used to mark a token as unable to publish when configuring limited access tokens with the npm token create command.

cidr

  • 默认值:null

    ¥Default: null

  • 类型:null 或 String(可设置多次)

    ¥Type: null or String (can be set multiple times)

这是使用 npm token create 命令配置受限访问令牌时要使用的 CIDR 地址列表。

¥This is a list of CIDR address to be used when configuring limited access tokens with the npm token create command.

registry

npm 注册表的基本 URL。

¥The base URL of the npm registry.

otp

  • 默认值:null

    ¥Default: null

  • 类型:空值或字符串

    ¥Type: null or String

这是来自双重身份验证器的一次性密码。使用 npm access 发布或更改包权限时需要它。

¥This is a one-time password from a two-factor authenticator. It's needed when publishing or changing package permissions with npm access.

如果未设置,并且注册表响应失败并询问一次性密码,npm 将在命令行上提示输入一次密码。

¥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.

也可以看看

¥See Also

npm 中文网 - 粤ICP备13048890号