npm-login
authenticates with an npm registry
TLDR
Login to npm registry
$ npm login
Login to specific registry$ npm login --registry=[https://registry.example.com]
Login with scope$ npm login --scope=@[myorg]
Check login status$ npm whoami
Logout$ npm logout
SYNOPSIS
npm login [options]
DESCRIPTION
npm login (also npm adduser) authenticates with an npm registry. Credentials are stored in ~/.npmrc and used for publishing and accessing private packages.
For npm.js, this enables publishing packages and accessing private organization packages.
PARAMETERS
--registry url
Registry URL.--scope scope
Associate login with scope.--auth-type type
Authentication type.
AUTHENTICATION FLOW
$ # Standard login
npm login
# Enter username, password, email, OTP if enabled
# Verify
npm whoami
# Output: your-username
# View token
npm token list
npm login
# Enter username, password, email, OTP if enabled
# Verify
npm whoami
# Output: your-username
# View token
npm token list
NPMRC LOCATIONS
$ ~/.npmrc # User config
./.npmrc # Project config
/etc/npmrc # Global config
./.npmrc # Project config
/etc/npmrc # Global config
CAVEATS
Tokens stored in plaintext in .npmrc. Use npm token for token management. 2FA may be required.
HISTORY
npm login has been part of npm since its early versions, evolving to support 2FA and multiple registries.
SEE ALSO
npm(1), npm-publish(1), npm-whoami(1), npm-token(1)
