How do I refresh the credentials or use different ones then I have set up?
Because of invalid credentials I get the error code E401 Unauthorized.
@adiii4,
Need more information.
I'm using on-prem also my agent is win. What I mean is the following: Imagine I set up vsts-npm-auth for the first time and enter my credentials. Now after a couple months I want to change my entered credentials (which I have set up the first time) to completly enter new credentials.
I found this but it didn't work. The message I got was 'entered credentials already for xx'.
Now my questions is how can I enter new credentials or overwrite the existing credentials?
@adiii4 ,
Are you saying that you have manually configured credentials for NPM on the build agent? If so, you should not do this. The NPMv2 task will automatically fetch credentials and inject them into your project's .npmrc for you.
This is all documented here in the "Set up authentication in a build task" section.
No I didn't. What I mean the first time you use vsts-npm-auth you have to enter your credentials via the terminal. My question is how do I change those credentials I entered?
@adiii4,
There are two things at play here.
1) VSTS npm auth will first check the credentials in your .npmrc to see if they need refreshing. If they don't the tool will abort and not do anything. You can override this behavior with "force" or by simply removing credentials from your .npmrc.
2) The tool will save VSTS creds in [1]. You need to remove [1] to get the login prompt again.
[1] HKEY_CURRENT_USER\SOFTWARE\Microsoft\VSCommon\14.0\ClientServices\TokenStorage\VisualStudio\VssApp
@adiii4,
There are two things at play here.VSTS npm auth will first check the credentials in your .npmrc to see if they need refreshing. If they don't the tool will abort and not do anything. You can override this behavior with "force" or by simply removing credentials from your .npmrc.
The tool will save VSTS creds in [1]. You need to remove [1] to get the login prompt again.[1] HKEY_CURRENT_USER\SOFTWARE\Microsoft\VSCommon\14.0\ClientServices\TokenStorage\VisualStudio\VssApp
I don't have this registry entry. Has it changed? I'm not getting a prompt to enter my credentials so I constantly get a 401 when running npm install.
try add -F flag to force prompt
ex: vsts-npm-auth -F -config .npmrc
try add -F flag to force prompt
ex: vsts-npm-auth -F -config .npmrc
Thank you. This worked for me.
Most helpful comment
try add -F flag to force prompt
ex: vsts-npm-auth -F -config .npmrc