npm profile enable-2fa auth-and-writes

Category: Node.js & npm/yarn

npm profile enable-2fa auth-and-writes

Enable two-factor authentication on npm

Turns on 2FA for your account and requires a one-time password for every login and publish, protecting packages you own. The auth-and-writes mode is the strongest option; auth-only still allows publishes with a saved token. You will be prompted for the authenticator code to finish.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.