1 --- 2section: cli-commands 3title: npm-adduser 4description: Set access level on published packages 5--- 6 7# npm-adduser(1) 8 9## Add a registry user account 10 11### Synopsis 12 13```bash 14npm adduser [--registry=url] [--scope=@orgname] [--always-auth] [--auth-type=legacy] 15 16aliases: login, add-user 17``` 18 19### Description 20 21Create or verify a user named `<username>` in the specified registry, and 22save the credentials to the `.npmrc` file. If no registry is specified, 23the default registry will be used (see [`config`](/using-npm/config)). 24 25The username, password, and email are read in from prompts. 26 27To reset your password, go to <https://www.npmjs.com/forgot> 28 29To change your email address, go to <https://www.npmjs.com/email-edit> 30 31You may use this command multiple times with the same user account to 32authorize on a new machine. When authenticating on a new machine, 33the username, password and email address must all match with 34your existing record. 35 36`npm login` is an alias to `adduser` and behaves exactly the same way. 37 38### Configuration 39 40#### registry 41 42Default: https://registry.npmjs.org/ 43 44The base URL of the npm package registry. If `scope` is also specified, 45this registry will only be used for packages with that scope. `scope` defaults 46to the scope of the project directory you're currently in, if any. See [`scope`](/using-npm/scope). 47 48#### scope 49 50Default: none 51 52If specified, the user and login credentials given will be associated 53with the specified scope. See [`scope`](/using-npm/scope). You can use both at the same time, 54e.g. 55 56```bash 57 npm adduser --registry=http://myregistry.example.com --scope=@myco 58``` 59 60This will set a registry for the given scope and login or create a user for 61that registry at the same time. 62 63#### always-auth 64 65Default: false 66 67If specified, save configuration indicating that all requests to the given 68registry should include authorization information. Useful for private 69registries. Can be used with `--registry` and / or `--scope`, e.g. 70 71```bash 72 npm adduser --registry=http://private-registry.example.com --always-auth 73``` 74 75This will ensure that all requests to that registry (including for tarballs) 76include an authorization header. This setting may be necessary for use with 77private registries where metadata and package tarballs are stored on hosts with 78different 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. 79 80#### auth-type 81 82* Default: `'legacy'` 83* Type: `'legacy'`, `'sso'`, `'saml'`, `'oauth'` 84 85What authentication strategy to use with `adduser`/`login`. Some npm registries 86(for example, npmE) might support alternative auth strategies besides classic 87username/password entry in legacy npm. 88 89### See Also 90 91* [npm registry](/using-npm/registry) 92* [npm config](/cli-commands/npm-config) 93* [npmrc](/configuring-npm/npmrc) 94* [npm owner](/cli-commands/npm-owner) 95* [npm whoami](/cli-commands/npm-whoami) 96