如果你的账户启用了双重访问,并且你无法访问你的 2FA 设备,你可以使用以下方法恢复你的账户。

¥When you have two-factor access enabled on your account, and you lose access to your 2FA device, you may be able to recover your account using the following methods.

遗失的第二重设备

¥Misplaced second factor device

如果你遗失了提供第二重身份验证的设备,你可以使用你 启用 2FA 时生成的恢复码访问你的账户。

¥If you have misplaced the device that provided second-factor authentication, you can use the recovery codes generated when you enabled 2FA to access your account.

在网站上使用恢复代码

¥Using recovery code on the web

  1. 找到你保存的生成的恢复代码。

    ¥Locate the recovery codes generated that you have saved.

  2. 在 npm“登录”页面上,输入您的帐户详细信息并单击登录Screenshot of npm login dialog
  3. 在“双重身份验证”页面上,点击使用恢复代码或请求重置Screenshot showing Security Key prompt with a link to navigate to the recovery code input screen

    注意:如果你已配置为使用 TOTP,你将看到 TOTP 提示

    ¥Note: If you have configured to use TOTP, you will see an TOTP prompt instead

  4. 在 "使用恢复代码" 提示中输入未使用的恢复代码。

    ¥Enter an unused recovery code in the "Use a Recovery Code" prompt.

    Screenshot showing use a recovery code prompt with an input box to enter the recovery code
  5. 你现在已登录到 npm。

    ¥You are now logged into npm.

  6. (可选的)要禁用 2FA,请参阅“禁用 2FA”。

    ¥(Optional) To disable 2FA, see "Disabling 2FA".

从命令行使用恢复代码

¥Using recovery code from the command line

  1. 找到你在账户上启用 2FA 时生成的恢复代码。

    ¥Locate the recovery codes generated when you enabled 2FA on your account.

  2. 如果你在命令行上注销,请使用你的用户名和 npm 密码使用 npm login 命令登录。

    ¥If you are logged out on the command line, log in using npm login command with your username and npm password.

  3. 看到此提示时输入未使用的恢复代码:

    ¥Enter an unused recovery code when you see this prompt:

    Enter one-time password:
  4. 登录后,如果出现提示,请使用以下内容并输入你的 npm 密码。

    ¥Once you are logged in, use the below and enter your npm password if prompted.

    npm profile disable-2fa
  5. 当你看到此提示时,输入另一个未使用的恢复代码:

    ¥Enter another unused recovery code when you see this prompt:

    Enter one-time password:
  6. npm 将确认双重身份验证已被禁用。

    ¥npm will confirm that two-factor authentication has been disabled.

  7. 按照“配置双重身份验证”中概述的步骤重新启用 2FA 并生成新的恢复代码。

    ¥Follow the steps outlined in "Configuring two-factor authentication" to re-enable 2FA and generate new recovery codes.

注意:使用恢复代码重新启用 2FA 可能会创建一个具有相同 npm 账户名称的新身份验证器账户。

¥Note: Using the recovery codes to re-enable 2FA may create a new authenticator account with the same npm account name.

如果你使用的是 基于时间的一次性密码 (TOTP) 移动应用并想删除旧的验证器账户,请按照验证器的步骤操作。

¥If you are using a time-based one-time password (TOTP) mobile app and want to delete the old authenticator account, follow the steps for the authenticator.

查看和重新生成恢复代码

¥Viewing and regenerating recovery code

注意:重新生成一组代码后,所有以前的恢复代码都将失效。每个代码只能使用一次。

¥Note: Once you regenerate a set of code, all previous recovery codes become invalid. Each code can be used only once.

  1. 在 npm“登录”页面上,输入您的帐户详细信息并单击登录Screenshot of npm login dialog
  2. 在页面的右上角,点击您的个人资料照片,然后点击帐户Screenshot of account settings selection in user menu
  3. 在账户设置页面的 "双重身份验证" 下,单击修改 2FA。

    ¥On the account settings page, under "Two-Factor Authentication", click Modify 2FA.

    Screenshot showing Modify 2FA button
  4. 单击 "管理恢复代码" 查看你的恢复代码。

    ¥Click "Manage Recovery Codes" to view your recovery codes.

    Screenshot showing existing recovery codes and a button to generate set of recovery codes
  5. 单击 "重新生成代码" 生成一组新代码。

    ¥Click "Regenerate Code" to generate a new set of codes.

遗失的恢复代码

¥Misplaced recovery codes

如果你放错了 2FA 设备和恢复代码,你可以联系我们的支持团队尝试恢复你的账户。提供尽可能多的信息,以帮助我们更快地处理请求。

¥If you have misplaced both your 2FA device and your recovery codes, you can contact our support team to attempt to recover your account. Provide as much information as possible to help us expedite the request faster.

  1. 在 npm“登录”页面上,输入您的帐户详细信息并单击登录Screenshot of npm login dialog
  2. 在“双重身份验证”页面上,点击使用恢复代码或请求重置Screenshot showing Security Key prompt with a link to navigate to the recovery code input screen
  3. 在 "使用恢复代码" 表单下,单击尝试恢复你的账户。

    ¥Under the "Use a Recovery Code" form, click Try recovering your account.

  4. 在“请求帐户恢复”页面上,点击开始帐户恢复Screenshot showing account recovery page
  5. 如果你有权访问你的注册电子邮件,请在一次性密码字段中输入发送到你的电子邮件的一次性密码,然后单击验证电子邮件地址。如果你无法访问注册电子邮件,请选择表单底部的跳过电子邮件验证。

    ¥If you have access to your registered email, enter the one-time password sent to your email in the One-Time Password field, then click Verify Email Address. If you do not have access to your registered email, select Skip email verification at the bottom of the form.

  6. 在“Open a Support Ticket”表格中,输入以下信息:
    • 电子邮件字段中,输入我们的支持团队可以与您联系的电子邮件地址。
    • 在“我们能提供什么帮助?”中部分,选择重置我的双重身份验证 (2FA)。

      ¥In the How can we help? section, select Reset my two-factor authentication (2FA).

    • 如果您需要任何其他帮助,请在我们如何提供帮助?部分选择其他,然后在其他详细信息字段中输入更多信息。
      • 如果您之前已将 GitHub 帐户链接到您的 npm 帐户,请选择连接到 GitHub。 这将帮助我们的支持团队验证您的帐户。
      • 如果您之前已将 Twitter 帐户链接到您的 npm 帐户,请选择连接到 Twitter。 这将帮助我们的支持团队验证您的帐户。
    Screenshot showing existing recovery codes and a button to generate set of recovery codes
  7. 在表单底部,点击提交支持请求
npm 中文网 - 粤ICP备13048890号