Update vsts-npm-auth with new username and password
Asked Answered
L

5

6

I have installed the vsts-npm-auth package using following command:

npm install -g vsts-npm-auth --registry https://registry.npmjs.com

And I ran vsts-npm-auth -config .npmrc command to set the credential but I am facing below error:

enter image description here

Now I need to update the credential but it always fetches the existing credential. Is there any way to send PUT request and update the credential ?

Lail answered 8/5, 2017 at 5:47 Comment(0)
L
13

I made it work with help of my colleague.

  1. Uninstall vsts-npm-auth package
  2. remove NPM cache
  3. delete .npmrc file under Users folder
  4. And re-run the below command with auth flag set to false. It will ask for the creds.

    npm install -g vsts-npm-auth --registry https://registry.npmjs.com --always-auth false

Lail answered 8/5, 2017 at 9:38 Comment(3)
Since you solved the problem by yourself, you can mark it as answer. And it will help others who have similar questions.Boyish
For anyone who's wondering how to clear NPM cache: npm cache clean --forceGreasy
Thank you. Just running: npm install -g vsts-npm-auth --registry registry.npmjs.com --always-auth false without anything else... solved the problem for me. After that, npx vsts-npm-auth -config .npmrc ran successfully and popped up the prompt for Azure creds.Klee
U
9

Just run "vsts-npm-auth -F -config .npmrc"

Undertenant answered 5/8, 2022 at 2:17 Comment(0)
W
3

If the above solution is not working. I am adding a few more steps to the above answer

  1. Uninstall vsts-npm-auth package

  2. remove NPM cache

  3. delete .npmrc file under Users folder //new steps

  4. https://github.com/Microsoft/azure-pipelines-tasks/issues/6733#issuecomment-376604435 As mentioned in the link remove the already existing token and details to show the login prompt again open regedit (windowsKey + R + type "regedit") delete -> HKEY_CURRENT_USER\SOFTWARE\Microsoft\VSCommon\14.0\ClientServices\TokenStorage\VisualStudio\VssApp

  5. Restart your system

  6. And re-run the below command with auth flag set to false. It will ask for the creds.

npm install -g vsts-npm-auth --registry https://registry.npmjs.com --always-auth false

  1. vsts-npm-auth -config .npmrc
Wisla answered 8/12, 2021 at 7:59 Comment(1)
It works for me, removing tokens in regedit is necessaryBanting
A
0
  1. Optional: Make a backup of your .npmrc file.
  2. Edit the .npmrc file.
  3. Delete the lines with the cached credentials. More specifically delete:
  • Any line ending with username=VssSessionToken
  • Any line starting with the comment ; This is an unencrypted authentication token.
  • Any line containing password=
  • Any line containing email=
  1. Save the file.
  2. Run vsts-npm-auth -config .npmrc
Auster answered 6/6, 2022 at 19:38 Comment(0)
S
-1

The VSTS will save creds in the Windows registry. You need to remove the token to get the login prompt again.

Here is the path in Windows Registry :

HKEY_CURRENT_USER\SOFTWARE\Microsoft\VSCommon\14.0\ClientServices\TokenStorage\VisualStudio\VssApp

enter image description here

Steinbach answered 3/5, 2023 at 19:43 Comment(1)
Token is not creating even after new VssSessionToken generation.Bioenergetics

© 2022 - 2025 — McMap. All rights reserved.