npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

npm says login failed due to OTP when given a bad password

What I Wanted to Do

Login to my npm account with the cli

What Happened Instead

When I entered my password incorrectly it asked for my OTP token, which i entered correctly. It then rejected my login (correctly), but the error message was:

npm ERR! code EOTP
npm ERR! This operation requires a one-time password from your authenticator.
npm ERR! You can provide a one-time password by passing --otp=<code> to the command you ran.
npm ERR! If you already provided a one-time password then it is likely that you either typoed
npm ERR! it, or it timed out. Please try again.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/todd/.npm/_logs/2018-07-16T16_38_57_904Z-debug.log

(I tried several times to verify that it was a bad password – if I type it in correctly, it works every time)

Reproduction Steps

  1. enable 2fa for login
  2. npm login
  3. type username
  4. type password incorrectly
  5. type OTP token correctly2018-07-16T16_38_57_904Z-debug.log (2.3 KB)


The error message is super confusing

Platform Info

$ npm --versions
{ '@scriptollc/collab-editor': '6.0.5',
  npm: '6.1.0',
  ares: '1.10.1-DEV',
  cldr: '32.0',
  http_parser: '2.8.0',
  icu: '60.1',
  modules: '57',
  napi: '3',
  nghttp2: '1.29.0',
  node: '8.11.2',
  openssl: '1.0.2o',
  tz: '2017c',
  unicode: '10.0',
  uv: '1.19.1',
  v8: '6.2.414.54',
  zlib: '1.2.11' }

$ node -p process.platform

This seems to be an issue with the registry. It’s returning an EOTP error code when login fails.