Gathering detailed insights and metrics for better-vsts-npm-auth
Gathering detailed insights and metrics for better-vsts-npm-auth
Gathering detailed insights and metrics for better-vsts-npm-auth
Gathering detailed insights and metrics for better-vsts-npm-auth
Platform agnostic library and acompanying oauth service enabling developers to easily obtain and use tokens for authorizing NPM feeds in VSTS
npm install better-vsts-npm-auth
Typescript
Module System
Min. Node Version
Node Version
NPM Version
TypeScript (95.09%)
JavaScript (4.91%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
54 Stars
76 Commits
15 Forks
4 Watchers
19 Branches
6 Contributors
Updated on Jul 03, 2025
Latest Version
7.0.1
Package Id
better-vsts-npm-auth@7.0.1
Unpacked Size
139.28 kB
Size
29.71 kB
File Count
39
NPM Version
8.12.1
Node Version
18.4.0
Published on
Aug 17, 2023
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Platform agnostic library and accompanying oauth service enabling developers to easily obtain and use tokens for authorizing NPM feeds in VSTS
While not necessary, better-vsts-npm-auth was built to be used as a global module.
npm i -g better-vsts-npm-auth
Azure DevOps (formerly Visual Studio Team Services aka VSTS) uses OAuth to authorize access to resources - like your npm registries! Better-vsts-npm-auth is one half of a two-part solution: better-vsts-npm-auth
is the piece of software which you install on your machine, and it handles all the OAuth magic for you. The second part of the equation is stateless-vsts-oauth
which is a very simple web endpoint which handles the OAuth flow described above. I designed both tools such that they never store your data - only you decide where your data is stored. To see how that happens, and help you through your first use of better-vsts-npm-auth
I'll walk you through the process:
better-vsts-npm-auth
. It's going to print a warning like so, follow the instructions:
Note: take special notice of the text printed between the
*****
- it'stelling you thatasking you politely toCtrl+Click
(⌘+Click
on Mac) that link and sign in with the account you use to access your dev.azure.com project. Without that,better-vsts-npm-auth
can't help you!
better-vsts-npm-auth
in step 1, you're invoking a command which is going to save that very sensitive piece of text onto your hard drive. It's important to know that's where this is stored: .vstsnpmrc
in your home directory (along with other important and sensitive pieces of text in your .npmrc
). This text is a refresh token - it allows better-vsts-npm-auth
to continue acquiring access tokens on your behalf. To learn more about what these tokens are for, check out the link at the top of the page which details OAuth and how VSTS uses it.
better-vsts-npm-auth
and your credentials will be refreshed silently and you're be all set to install your npm packages.Note: The CLI comes with help docs, so if you can't find what you're looking for here, try
better-vsts-npm-auth --help
.
While incomplete - the lack of support for *nix systems was perplexing - vsts-npm-auth laid the foundation for this project in principle.
VSTS's OAuth flow is documented here. It requires an internet-facing service to complete the token exchanges. While you're welcome to use an existing service if you have one or build your own if you're so inclined, you can also use this service as-is. It's hosted at https://stateless-vsts-oauth.azurewebsites.net.
better-vsts-npm-auth
programmaticallyProvided for direct integration with application-specific tooling. On my team, we use this in our preinstall script for our project to harden our system against annoying token expirations needlessly breaking our development mojo.
Example:
const vstsAuth = require('better-vsts-npm-auth');
const input = require('input');
vstsAuth.run()
.then(() => console.log('woohoo! No more annoying 401s'))
.catch(e => {
// we can catch AuthorizationError and prompt our users to
// authorize the Stateless VSTS NPM OAuth application
// (or your own application, if you specify an alternate
// clientId in your config, which you're welcome to do)
if (vstsAuth.isAuthorizationError(e)){
// fail if we're running in a lab
if (process.env['BUILD_BUILDID'] || process.env['RELEASE_RELEASEID']){
return Promise.reject(e);
}
// wait for user input if we're running on a dev box
// note - I like the input package, but feel free to get your user
// input however you'd like
return input.text('paste your refresh_token:').
then(token => {
vstsAuth.setRefreshToken(token);
// not necessary, but nifty if you want to create a
// seamless local dev startup experience by re-running
return vstsAuth.run();
})
}});
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 3/24 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
33 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More