Skip to content

[BUG] npm profile enable-2fa preforms operation but shows error #8192

Open
@reggi

Description

@reggi

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

➜  ~    npm profile enable-2fa auth-and-writes
npm notice profile Enabling two factor authentication for auth-and-writes
npm password: 
Enter one-time password: xxxxxx

npm error Unknown error enabling two-factor authentication. Expected otpauth URL, got: { pending: false, mode: 'auth-and-writes' }
npm error A complete log of this run can be found in: /Users/reggi/.npm/_logs/2025-03-27T16_54_09_998Z-debug-0.log

tfa here doesn't need to be a string and it's asserting that it should

https://github.com/npm/cli/blob/latest/lib/commands/profile.js#L322

➜  ~    npm profile enable-2fa auth-only    
npm notice profile Enabling two factor authentication for auth-only
npm password: 
Enter one-time password: xxx

npm error Unknown error enabling two-factor authentication. Expected otpauth URL, got: { pending: false, mode: 'auth-only' }
npm error A complete log of this run can be found in: /Users/reggi/.npm/_logs/2025-03-27T17_07_52_652Z-debug-0.log

Expected Behavior

No response

Steps To Reproduce

  1. In this environment...
  2. With this config...
  3. Run '...'
  4. See error...

Environment

  • npm:
  • Node.js:
  • OS Name:
  • System Model Name:
  • npm config:
; copy and paste output from `npm config ls` here

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next steps

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions