Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] NPM Logout Removes Wrong Access Token #3888

Closed
1 task done
Striar-Yunis opened this issue Oct 13, 2021 · 1 comment · Fixed by #6895
Closed
1 task done

[BUG] NPM Logout Removes Wrong Access Token #3888

Striar-Yunis opened this issue Oct 13, 2021 · 1 comment · Fixed by #6895
Assignees
Labels
Bug thing that needs fixing Priority 1 high priority issue Release 7.x work is associated with a specific npm 7 release

Comments

@Striar-Yunis
Copy link

Striar-Yunis commented Oct 13, 2021

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.
@Striar-Yunis Striar-Yunis added Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release labels Oct 13, 2021
@wraithgar wraithgar added Priority 1 high priority issue and removed Needs Triage needs review for next steps labels May 3, 2022
@wraithgar
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Priority 1 high priority issue Release 7.x work is associated with a specific npm 7 release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants