选择命令行版本:
🌐 Synopsis
npm token listnpm 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 请求制表符分隔的值。Read only token npm_1f… with id 7f3134 created 2017-10-21Publish token npm_af… with id c03241 created 2017-10-02with IP Whitelist: 192.168.0.1/24Publish token npm_… with id e0cf92 created 2017-10-02
npm token create [--read-only] [--cidr=<cidr-ranges>]:创建一个新的身份验证令牌。它可以是 --read-only,或者接受一个 CIDR 范围的列表,用于限制该令牌的使用。这将提示你输入密码,如果你启用了双因素认证,还会要求输入一次性密码(OTP)。
目前,CLI 无法生成自动化令牌。有关生成自动化令牌的更多信息,请参阅文档网站。
Created publish token a73c9572-f1b9-8983-983d-ba3ac3cc913d
npm token revoke <token|id>:立即从注册表中移除身份验证令牌。你将无法再使用它。此功能可以接受完整的令牌(例如你从 npm token create 获取的令牌以及在 .npmrc 中找到的令牌),也可以接受在 npm token list 的可解析输出或 JSON 输出中看到的 ID。它不接受在常规 npm token list 输出中显示的截断令牌。🌐 Configuration
read-only这用于在使用 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这是一个 CIDR 地址列表,用于在使用 npm token create 命令配置有限访问令牌时使用。
🌐 This is a list of CIDR address to be used when configuring limited access tokens with the npm token create command.
registrynpm 注册表的基本 URL。
🌐 The base URL of the npm registry.
otp这是来自双因素认证器的一次性密码。在使用 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