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.
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.
Locate the recovery codes generated that you have saved.
Note: If you have configured to use TOTP, you will see an TOTP prompt instead
Enter an unused recovery code in the "Use a Recovery Code" prompt.
You are now logged into npm.
(Optional) To disable 2FA, see "Disabling 2FA".
Locate the recovery codes generated when you enabled 2FA on your account.
If you are logged out on the command line, log in using npm login command with your username and npm password.
Enter an unused recovery code when you see this prompt:
Once you are logged in, use the below and enter your npm password if prompted.
npm profile disable-2fa Enter another unused recovery code when you see this prompt:
npm will confirm that two-factor authentication has been disabled.
Follow the steps outlined in "Configuring two-factor authentication" to re-enable 2FA and generate new recovery codes.
Note: Using the recovery codes to re-enable 2FA may create a new authenticator account with the same npm account name.
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.
Note: Once you regenerate a set of code, all previous recovery codes become invalid. Each code can be used only once.
On the account settings page, under "Two-Factor Authentication", click Modify 2FA.
Click "Manage Recovery Codes" to view your recovery codes.
Click "Regenerate Code" to generate a new set of codes.
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.
Under the "Use a Recovery Code" form, click Try recovering your account.
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.
© npm, Inc. and Contributors
Licensed under the npm License.
npm is a trademark of npm, Inc.
https://docs.npmjs.com/recovering-your-2fa-enabled-account