This is an old revision of the document!
I recently got a windows machine from work, I'm more comfortable with mac or linux, so I installed wsl2 (ubuntu), and setup nodejs development environment in it, I followed this guide: https://docs.microsoft.com/en-us/azure/devops/artifacts/npm/npmrc?view=azure-devops&tabs=windows#set-up-authentication-on-your-dev-box, and created the auth token from azure personal access token:
echo -n [personal-access-token] | base64
then added following to .npmrc:
; begin auth token //pkgs.dev.azure.com/<yourOrganization>/_packaging/<yourFeed>/npm/registry/:username=[ANY_VALUE_BUT_NOT_AN_EMPTY_STRING] //pkgs.dev.azure.com/<yourOrganization>/_packaging/<yourFeed>/npm/registry/:_password=[BASE64_ENCODED_PERSONAL_ACCESS_TOKEN] //pkgs.dev.azure.com/<yourOrganization>/_packaging/<yourFeed>/npm/registry/:email=npm requires email to be set but doesn't use the value //pkgs.dev.azure.com/<yourOrganization>/_packaging/<yourFeed>/npm/:username=[ANY_VALUE_BUT_NOT_AN_EMPTY_STRING] //pkgs.dev.azure.com/<yourOrganization>/_packaging/<yourFeed>/npm/:_password=[BASE64_ENCODED_PERSONAL_ACCESS_TOKEN] //pkgs.dev.azure.com/<yourOrganization>/_packaging/<yourFeed>/npm/:email=npm requires email to be set but doesn't use the value ; end auth token
but this only leads to an error:
npm ERR! code E401 npm ERR! Unable to authenticate, need: Bearer authorization_uri=https://login.windows.net/a1b03033-8a3d-4443-a90b-0f3298ffbf90, Basic realm="https://pkgsprodeau1.pkgs.visualstudio.com/", TFS-Federated npm ERR! A complete log of this run can be found in: npm ERR! /home/dcai/.npm/_logs/2021-02-04T22_20_51_870Z-debug.log
Coworker who directly work on windows told me they use Azure DevOps (formerly VSTS) Auth helper for authentication on windows 10,
Discussion