npm-token-switch v1.0.2
NPM Token Switch
A command line tool for changing between your existing NPM registry access tokens.
Installation
The tool requires at least Node v6 to run. To install npm-token-switch, just
run following command:
npm install -g npm-token-switchUsage
Every time you run npm-token-switch, it will create a backup of your current
active token. Once that has been done, it will prompt you to change between
saved tokens. So when using multiple accounts, follow these steps:
- Run
npm-token-switchto create a backup of currently active token - Run
npm loginto change to a different account - Run
npm-token-switchto toggle between accounts
Using login without username/password
The real purpose of this tool is to switch between tokens without needing to have login data. At times you may get read-only access to private tools, but without a password.
In cases where you have a token for a user, but not actual password,
you can easily add it to the npm-token-switch list:
echo "//registry.npmjs.org/:_authToken=your-npm-token" > ~/.npmrc.token.account-nameOf course replacing your-npm-token and account-name in the command.