Jason
Jason

Reputation: 2617

Azure DevOps Artifacts 401 error when publishing npm extension

I'm trying to get Azure DevOps Artifacts service up and running. I can get it to work with the 90-day token generated by DevOps but not with a custom PAT generated by my account Security panel. It just gives me a 401 error. I followed the instructions for the PAT from here: PAT instructions

My registry url is https://pkgs.dev.azure.com/mycompany/_packaging/packages/npm/registry/

My extension .npmrc file is like this:

registry=https://pkgs.dev.azure.com/mycompany/_packaging/packages/npm/registry/
always-auth=true

My system .npmrc is like this:

//registry.npmjs.org/:_authToken=xxxxxxxxxxxxxxxxxxxxxxxx
//pkgs.dev.azure.com/mycompany/_packaging/packages/npm/registry/:username=mycompany
//pkgs.dev.azure.com/mycompany/_packaging/packages/npm/registry/:_password=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//pkgs.dev.azure.com/mycompany/_packaging/packages/npm/registry/:[email protected]
//pkgs.dev.azure.com/mycompany/_packaging/packages/npm/registry/:always-auth=true

If it helps, here's the settings I used to generate the PAT:

DevOps PAT settings

Any guesses where I might be going wrong?

Upvotes: 2

Views: 3659

Answers (1)

Tom Sun
Tom Sun

Reputation: 24569

Any guesses where I might be going wrong?

Please have a try to generate a PAT with a narrow scope of "Packaging (read and write), not build permission. You could click the [show all scopes] to find it.

For more information, please refer to set up your npmrc files

enter image description here

enter image description here

Upvotes: 4

Related Questions