See Details目录

双重身份验证 (2FA) 通过使用以下方式确认你的身份,防止未经授权访问你的账户:

¥Two-factor authentication (2FA) protects against unauthorized access to your account by confirming your identity using:

  • 你知道的东西(例如,密码)。

    ¥Something you know (e.g., a password).

  • 你拥有的东西(例如,身份证或加密密钥)。

    ¥Something you have (e.g., an ID badge or a cryptographic key).

  • 你的身份(例如指纹或其他生物特性数据)。

    ¥Something you are (e.g., a fingerprint or other biometric data).

当你启用 2FA 时,系统会提示你进行第二种形式的身份验证,然后再对你的账户或你具有写入权限的包执行某些操作。系统将提示你使用 security-key 进行身份验证。

¥When you enable 2FA, you will be prompted for a second form of authentication before performing certain actions on your account or packages to which you have write access. You will be prompted to authenticate with a security-key.

注意:双重身份验证为你的账户提供了针对攻击者的最佳安全性。我们强烈建议你在注册后尽快在你的账户上启用 2FA。

¥Note: Two-factor authentication provides the best possible security for your account against attackers. We strongly recommend enabling 2FA on your account as soon as possible after you sign up.

重要提示:发布到 npm 需要以下任一选项:

¥Important: Publishing to npm requires either:

  • 你的账户已启用双重身份验证 (2FA),或者

    ¥Two-factor authentication (2FA) enabled on your account, OR

  • 启用绕过双重身份验证 (2FA) 的细粒度访问令牌

    ¥A granular access token with bypass 2FA enabled

更多信息,请参阅 npm 文档中关于 要求包发布时进行双重身份验证 的部分。

¥For more information, see the npm documentation on requiring 2FA for package publishing.

npm 上的双重身份验证

¥Two-factor authentication on npm

可以为授权和写入启用 npm 上的双重身份验证,或者仅启用授权。

¥Two-factor authentication on npm can be enabled for authorization and writes, or authorization only.

授权和写入

¥Authorization and writes

默认情况下,为授权和写入启用 2FA。我们将为某些授权操作以及写入操作请求第二种形式的身份验证。

¥By default, 2FA is enabled for authorization and writes. We will request a second form of authentication for certain authorized actions, as well as write actions.

动作CLI 命令
登录到 npmnpm login
更改个人资料设置(包括你的密码)npm profile set
为你的用户账户更改 2FA 模式npm profile enable-2fa auth-and-writes
为你的用户账户禁用 2FAnpm profile disable-2fa
创建令牌npm token create
撤销令牌npm token revoke
发布包npm publish
取消发布包npm unpublish
弃用包npm deprecate
更改包的可见性npm access public/restricted
更改用户和团队包访问权限npm access grant/revoke
更改包 2FA 要求npm access 2fa-required/2fa-not-required

仅授权

¥Authorization only

如果你启用 2FA 仅用于授权。我们将仅针对某些授权操作请求第二种形式的身份验证。

¥If you enable 2FA for authorization only. We will request a second form of authentication only for certain authorized actions.

动作CLI 命令
登录到 npmnpm login
更改个人资料设置(包括你的密码)npm profile set
为你的用户账户更改 2FA 模式npm profile enable-2fa auth-only
为你的用户账户禁用 2FAnpm profile disable-2fa
创建令牌npm token create
撤销令牌npm token revoke
npm v11.7 中文网 - 粤ICP备13048890号

目录