How do I log into Azure Artifacts with npm login?

670 Views Asked by At

Disclaimer: I already asked this question somewhere else, but I didn't get any satisfactory answer. I'll just quote the contents of that post below:

No matter what I try, I always get this error:

There is no user with the username "<USERNAME>".

Yes, I know, you are not supposed to use npm login, you have to follow these steps. But... why? Isn't the whole purpose of the npm login command to handle this kind of stuff? Why doesn't it work?

Also, I noticed some configs have 'registry/' appended at the end. I tried removing the ones without 'registry/' appended and I could publish a package. What are the configs without 'registry/' appended used for? I'm talking specifically about these ones:

//pkgs.dev.azure.com/<ORGANIZATION_NAME>/<PROJECT_NAME>/_packaging/<FEED_NAME>/npm/:username=[ENTER_ANY_VALUE_BUT_NOT_AN_EMPTY_STRING]
//pkgs.dev.azure.com/<ORGANIZATION_NAME>/<PROJECT_NAME>/_packaging/<FEED_NAME>/npm/:_password=[BASE64_ENCODED_PERSONAL_ACCESS_TOKEN]
//pkgs.dev.azure.com/<ORGANIZATION_NAME>/<PROJECT_NAME>/_packaging/<FEED_NAME>/npm/:email=npm requires email to be set but doesn't use the value
1

There are 1 best solutions below

0
On BEST ANSWER

The way npm login works is incompatible with the way Azure Active Directory, the identity provider used by Azure DevOps/Azure Artifacts, issues authentication tokens, so Azure Artifacts doesn't support it.

The presence of the two registry URI forms has to do with differences in the way that certain versions of npm handle the mapping between the registry URI and the entries in the .npmrc under certain circumstances.