2019-11-05 14:55:08 -05:00
---
section: cli-commands
title: npm-adduser
description: Set access level on published packages
---
2011-11-21 09:48:45 -08:00
2019-11-18 21:01:39 +02:00
# npm-adduser(1)
2011-11-21 09:48:45 -08:00
2019-11-05 14:55:08 -05:00
## Add a registry user account
2011-11-21 09:48:45 -08:00
2019-11-05 14:55:08 -05:00
### Synopsis
2016-03-29 23:30:51 -07:00
2019-11-05 14:55:08 -05:00
```bash
npm adduser [--registry=url] [--scope=@orgname ] [--always-auth] [--auth-type=legacy]
aliases: login, add-user
```
### Description
2011-11-21 09:48:45 -08:00
2014-09-24 14:41:07 -07:00
Create or verify a user named `<username>` in the specified registry, and
save the credentials to the `.npmrc` file. If no registry is specified,
2019-11-18 21:01:39 +02:00
the default registry will be used (see [`config` ](/using-npm/config )).
2011-11-21 09:48:45 -08:00
The username, password, and email are read in from prompts.
2015-01-08 14:37:26 -08:00
To reset your password, go to < https: / / www . npmjs . com / forgot >
2011-11-21 09:48:45 -08:00
2015-01-08 14:37:26 -08:00
To change your email address, go to < https: / / www . npmjs . com / email-edit >
2011-11-21 09:48:45 -08:00
You may use this command multiple times with the same user account to
2015-01-08 14:37:26 -08:00
authorize on a new machine. When authenticating on a new machine,
the username, password and email address must all match with
your existing record.
2011-11-21 09:48:45 -08:00
2014-09-24 14:41:07 -07:00
`npm login` is an alias to `adduser` and behaves exactly the same way.
2019-11-05 14:55:08 -05:00
### Configuration
2011-11-21 09:48:45 -08:00
2019-11-05 14:55:08 -05:00
#### registry
2011-11-21 09:48:45 -08:00
2016-01-28 18:11:35 -08:00
Default: https://registry.npmjs.org/
2011-11-21 09:48:45 -08:00
2014-09-24 14:41:07 -07:00
The base URL of the npm package registry. If `scope` is also specified,
2016-12-18 20:22:09 -08:00
this registry will only be used for packages with that scope. `scope` defaults
2019-11-18 21:01:39 +02:00
to the scope of the project directory you're currently in, if any. See [`scope` ](/using-npm/scope ).
2014-09-24 14:41:07 -07:00
2019-11-05 14:55:08 -05:00
#### scope
2014-09-24 14:41:07 -07:00
Default: none
If specified, the user and login credentials given will be associated
2019-11-18 21:01:39 +02:00
with the specified scope. See [`scope` ](/using-npm/scope ). You can use both at the same time,
2014-09-24 14:41:07 -07:00
e.g.
2019-11-05 14:55:08 -05:00
```bash
2020-10-20 17:02:27 -04:00
npm adduser --registry=http://myregistry.example.com --scope=@myco
```
2014-09-24 14:41:07 -07:00
This will set a registry for the given scope and login or create a user for
that registry at the same time.
2011-11-21 09:48:45 -08:00
2019-11-05 14:55:08 -05:00
#### always-auth
2014-11-04 15:08:12 -08:00
Default: false
If specified, save configuration indicating that all requests to the given
registry should include authorization information. Useful for private
registries. Can be used with `--registry` and / or `--scope` , e.g.
2019-11-05 14:55:08 -05:00
```bash
2020-10-20 17:02:27 -04:00
npm adduser --registry=http://private-registry.example.com --always-auth
2019-11-05 14:55:08 -05:00
```
2014-11-04 15:08:12 -08:00
This will ensure that all requests to that registry (including for tarballs)
2016-03-29 23:30:51 -07:00
include an authorization header. This setting may be necessary for use with
private registries where metadata and package tarballs are stored on hosts with
2019-11-18 21:01:39 +02:00
different hostnames. See `always-auth` in [`config` ](/using-npm/config ) for more details on always-auth. Registry-specific configuration of `always-auth` takes precedence over any global configuration.
2014-11-04 15:08:12 -08:00
2019-11-05 14:55:08 -05:00
#### auth-type
2017-04-12 21:47:49 -07:00
* Default: `'legacy'`
* Type: `'legacy'` , `'sso'` , `'saml'` , `'oauth'`
What authentication strategy to use with `adduser` /`login` . Some npm registries
(for example, npmE) might support alternative auth strategies besides classic
username/password entry in legacy npm.
2019-11-05 14:55:08 -05:00
### See Also
2011-11-21 09:48:45 -08:00
2019-11-05 14:55:08 -05:00
* [npm registry ](/using-npm/registry )
2020-10-02 17:52:19 -04:00
* [npm config ](/cli-commands/config )
2019-11-05 14:55:08 -05:00
* [npmrc ](/configuring-npm/npmrc )
2020-10-02 17:52:19 -04:00
* [npm owner ](/cli-commands/owner )
* [npm whoami ](/cli-commands/whoami )