Skip to content

[BUG] NPM Logout Removes Wrong Access Token #3888

Closed

Description

@Striar-Yunis

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

NPM Logout removes the wrong token leaving the login token available. Reproduced in v6, v7, and v8.0.0.

Expected Behavior

NPM login adds an access token to npm config user section.
NPM logout removes an access token from npm config user section.

Steps To Reproduce

  1. In this environment...
  • Go to: https://www.npmjs.com/settings/USER_NAME/tokens
  • Make a Read-Only token. Keep it's value.

    Screenshot from 2021-10-13 12-44-43
  • Make a new folder: mkdir test & cd test
  • Run: npm init
  • Add .npmrc: echo "//registry.npmjs.org/:_authToken=READ_ONLY_TOKEN" > .npmrc
  • Login: npm login (See second access token created)
    Screenshot from 2021-10-13 12-45-22
  • Logout: npm logout (See wrong token removed. Readonly token was deleted)
    Screenshot from 2021-10-13 12-46-03

Environment

  • OS: Ubuntu
  • Node: v14.18.0
  • npm: Last version tested was 8.0.0, but could recreate in 6 and 7.

Activity

  1. added
    Bugthing that needs fixing
    Needs Triageneeds review for next steps
    Release 7.xwork is associated with a specific npm 7 release
    on Oct 13, 2021
  2. added and removed
    Needs Triageneeds review for next steps
    on May 3, 2022
  3. wraithgar commented on May 3, 2022

    @wraithgar
    Contributor

    this.npm.config.delete(regRef, 'user')

  4. self-assigned this
    on Sep 26, 2023
  5. removed their assignment
    on Oct 9, 2023
  6. self-assigned this
    on Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Bugthing that needs fixingPriority 1high priority issueRelease 7.xwork is associated with a specific npm 7 release

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions