Reputation: 668
I'm using AzureDevop artifacts for npm feeds. When I try to do npm install
I'm getting 401 Unauthorized
exception.
Any idea what is causing it ?
Upvotes: 3
Views: 9730
Reputation: 780
It might be worth pointing out that even if your token is clearly NOT expired, still try to renew it and see what happens. This solved my problem (yarn install
with 401 Unauthorized)
Upvotes: 0
Reputation: 17125
Most probably your token is expired.
Personal access tokens
Packaging (Read)
access to the failing url in 401 error message.vsts-npm-auth -config .npmrc -F
If it's your first time you have to create a new token with sufficent access to packaging and run npm install -g vsts-npm-auth
in your console before running vsts-npm-auth -config .npmrc -F
(I always put that -F
there even if it's not needed).
If you're still having problem I suggest you find the detailed instructions in the Azure Devops:
Having issues? See the instructions for using a Personal Access Token to authenticate.
and read the whole instructions.Upvotes: 1
Reputation: 9011
Your authorization token has probably expired. Go to you .npmrc file and look for the following section to confirm expiration date of token, as highlighted:
To update it, Login to azure DevOps:
Upvotes: 4
Reputation: 668
I figured it out. My authorization token expired. Just needed to go to feed/connect-to-feed and regenerate token for npm and put it into .npmrc file.
Upvotes: 3