Authenticating to Azure DevOps results in 401 since switch from :authtoken
We recently upgraded to a newer version of TFS -> Azure DevOps. Before that point in time, we were able to authenticate to npm. Everything worked just as we expected. After we install now, we are getting the following error
16338 verbose stack Error: Unable to authenticate, need: Bearer, Basic realm="http:/{host}/", Negotiate, NTLM
16338 verbose stack at res.buffer.catch.then.body (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-registry-fetch\check-response.js:94:17)
16338 verbose stack at process._tickCallback (internal/process/next_tick.js:68:7)
Currently
config set "//{collection|/_packaging/NPMFeed/npm/registry/:username" "NPMFeed"
config set "//{collection|/_packaging/NPMFeed/npm/registry/:_password" "{password}"
config set "//{collection|/_packaging/NPMFeed/npm/registry/:email" "npm requires email to be set but doesn't use the value"
config set "//{collection|/_packaging/NPMFeed/npm/:username" "NPMFeed"
config set "//{collection|/_packaging/NPMFeed/npm/:_password" "{password}"
config set "//{collection|/_packaging/NPMFeed/npm/:email=" "npm requires email to be set but doesn't use the value"
Previously
config set "//{collection|/_packaging/NPMFeed/npm/registry/:authtoken" "{authtoken}"
Please sign in to leave a comment.
Hi Michael,
You have mentioned authenticating to "npm". How and when is this failing? Is this during some build step? If so, which one?
We were able to isolate this issue. It was just a misunderstanding into npm set config and the way it was being used. It had populated both the authtoken (the old method) and the new username and password. This caused it to always get a 401 until we cleared the .npmrc file on the build agent.