# Azure DevOps (formerly VSTS) Auth helper for npm

Integrate npm and Azure Artifacts with this authentication bootstrapper.

## Get started

### Install and run the tool
```
npm install -g vsts-npm-auth
vsts-npm-auth -config path-to-your\.npmrc
```

## Integrate into a bootstrapper script

### Configure your .npmrc in your project directory
```
registry=https://my-azure-artifacts-npm-registry-uri-here
always-auth=true
```

### Configure your init bootstrapper
```bash
$ npm install -g vsts-npm-auth --registry https://registry.npmjs.com
$ vsts-npm-auth -config path-to-your\.npmrc
```

## Platform support
The auth helper is currently only functional on a Windows machine. Users on other platforms
will need to get a Personal Access Token from their Azure DevOps Services (formerly Visual Studio Team Services)
account and manually configure their user .npmrc

## Options
```
c:\>.\vsts-npm-auth.exe -?
Usage - vsts-npm-auth -options

GlobalOption             Description
Help (-?)                Shows this help
NonInteractive (-N)      Don't allow interactively prompting for credentials to obtain a token
Config* (-C)             Comma-separated list of paths to npm configuration file containing package sources to
                         acquire authentication tokens for
TargetConfig (-T)        npm configuration file to write the generated tokens to. Usually user tokens are written to
                         %USERPROFILE%/.npmrc, ~/.npmrc or $HOME/.npmrc
ExpirationMinutes (-E)   Minutes until acquired tokens should expire. [Default='129600']
ReadOnly (-R)            Request a read-only token. If absent or false, a read-write token will be requested. This
                         parameter is effective only if the target configuration file has no token or a token that
                         is near or past expiration. To force token acquisition, use the -Force parameter.
                         [Default='False']
Force (-F)               Force token acquisition. If absent or false, an existing token in the target configuration
                         file will only be replaced if it is near or past expiration. [Default='False']
Verbosity (-V)           Display this amount of detail in the output: silent, quiet, normal, detailed.
                         Silent
                         Quiet
                         Normal
                         Detailed
```