{"id":18152,"library":"best-vsts-npm-auth","title":"Best VSTS NPM Auth","description":"A CLI tool that refreshes Azure DevOps Artifacts and GitHub Packages npm authentication on your machine. It reads your project .npmrc, obtains an access token via Azure CLI (no app registration required), and writes short-lived tokens (valid ~1 hour) to your user ~/.npmrc and optionally project .yarnrc.yml. Current stable version is 1.0.5. Key differentiators: simple setup with no app registration, supports Yarn Berry, and works with scoped registries. Works on Node.js with Azure CLI.","status":"active","version":"1.0.5","language":"javascript","source_language":"en","source_url":null,"tags":["javascript"],"install":[{"cmd":"npm install best-vsts-npm-auth","lang":"bash","label":"npm"},{"cmd":"yarn add best-vsts-npm-auth","lang":"bash","label":"yarn"},{"cmd":"pnpm add best-vsts-npm-auth","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only since v1.0.0","wrong":"const AuthClient = require('best-vsts-npm-auth')","symbol":"AuthClient","correct":"import { AuthClient } from 'best-vsts-npm-auth'"},{"note":"ESM-only since v1.0.0","wrong":"const refreshToken = require('best-vsts-npm-auth').refreshToken","symbol":"refreshToken","correct":"import { refreshToken } from 'best-vsts-npm-auth'"},{"note":"ESM-only since v1.0.0","wrong":"const { parseNpmrc } = require('best-vsts-npm-auth')","symbol":"parseNpmrc","correct":"import { parseNpmrc } from 'best-vsts-npm-auth'"}],"quickstart":{"code":"// Install globally\nnpm i -g best-vsts-npm-auth\n\n# Run in project directory\nbest-vsts-npm-auth .\n\n# Or specify .npmrc path\nbest-vsts-npm-auth -n /path/to/.npmrc\n\n# Also update Yarn Berry config\nbest-vsts-npm-auth -y ./.yarnrc.yml .","lang":"typescript","description":"Shows installation and common CLI usage to refresh npm authentication for Azure DevOps or GitHub Packages."},"warnings":[{"fix":"Run 'best-vsts-npm-auth' again to refresh tokens.","message":"Access tokens are valid for approximately 1 hour. Re-run the tool if you see 401 errors.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Expect tokens in ~/.npmrc. Check project .npmrc for any overriding settings.","message":"Tokens are written only to the user ~/.npmrc, not the project .npmrc, unless configured otherwise.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Install Azure CLI from https://docs.microsoft.com/en-us/cli/azure/install-azure-cli and run 'az login'.","cause":"Azure CLI is not installed or not in PATH.","error":"Error: Azure CLI not found. Please install Azure CLI and login with 'az login'."},{"fix":"Ensure your .npmrc includes registry settings for Azure DevOps or GitHub Packages.","cause":"The provided .npmrc does not contain any registry entries.","error":"Error: No registries found in .npmrc."},{"fix":"Run 'az login' and then retry the tool.","cause":"Azure CLI session expired or not logged in.","error":"Error: Failed to refresh token. Check your Azure login status."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}