Skip to content

2FA not asking for otp via command line #6741

@vecerek

Description

@vecerek

Bug report
2FA not working when using yarn publish despite the implementation in #6555 .
cc: @neonowy

What is the current behavior?
There are three cases I tried:

  1. npm login before yarn publish
  2. yarn login before yarn publish
  3. log out and make sure there is no _authCode in ~/.yarnrc before yarn publish

In case 1 and 2 I receive the error "You must provide a one-time pass. Upgrade your client to npm@latest in order to use 2FA."

In case 3, it asks me to log in but even though I type the correct password, I receive an error message saying Incorrect username or password..

STR:

  1. Create a new package from a boilerplate.
  2. Have the following set in your package.json:
{
  ...
  "version": "0.5.0",
  "publishConfig": {
    "access": "public",
    "registry": "https://registry.npmjs.org/"
  },
  ...
}
  1. run yarn publish --new-version major

A bit of background (probably unrelevant to this bug): I've had my package up until now in a private registry, now it's being open sourced. I'm moving the package to NPM with a major version bump.

What is the expected behavior?
In cases 1 and 2, I would expect yarn to execute this line and ask for the OTP code.
In case 3, I would expect it to correctly validate my password and then ask for the OTP code.

Please mention your node.js, yarn and operating system version.

  • Node version: v9.11.1
  • Yarn version: 1.10.1
  • NPM version: 6.4.1 (I'm providing it just because of the error message)
  • OS version: macOS High Sierra 10.13.6 (17G3025)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions