11cb0ef41Sopenharmony_ci---
21cb0ef41Sopenharmony_cititle: npm-logout
31cb0ef41Sopenharmony_cisection: 1
41cb0ef41Sopenharmony_cidescription: Log out of the registry
51cb0ef41Sopenharmony_ci---
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ci### Synopsis
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ci```bash
101cb0ef41Sopenharmony_cinpm logout
111cb0ef41Sopenharmony_ci```
121cb0ef41Sopenharmony_ci
131cb0ef41Sopenharmony_ciNote: This command is unaware of workspaces.
141cb0ef41Sopenharmony_ci
151cb0ef41Sopenharmony_ci### Description
161cb0ef41Sopenharmony_ci
171cb0ef41Sopenharmony_ciWhen logged into a registry that supports token-based authentication, tell
181cb0ef41Sopenharmony_cithe server to end this token's session. This will invalidate the token
191cb0ef41Sopenharmony_cieverywhere you're using it, not just for the current environment.
201cb0ef41Sopenharmony_ci
211cb0ef41Sopenharmony_ciWhen logged into a legacy registry that uses username and password
221cb0ef41Sopenharmony_ciauthentication, this will clear the credentials in your user configuration.
231cb0ef41Sopenharmony_ciIn this case, it will _only_ affect the current environment.
241cb0ef41Sopenharmony_ci
251cb0ef41Sopenharmony_ciIf `--scope` is provided, this will find the credentials for the registry
261cb0ef41Sopenharmony_ciconnected to that scope, if set.
271cb0ef41Sopenharmony_ci
281cb0ef41Sopenharmony_ci### Configuration
291cb0ef41Sopenharmony_ci
301cb0ef41Sopenharmony_ci#### `registry`
311cb0ef41Sopenharmony_ci
321cb0ef41Sopenharmony_ci* Default: "https://registry.npmjs.org/"
331cb0ef41Sopenharmony_ci* Type: URL
341cb0ef41Sopenharmony_ci
351cb0ef41Sopenharmony_ciThe base URL of the npm registry.
361cb0ef41Sopenharmony_ci
371cb0ef41Sopenharmony_ci
381cb0ef41Sopenharmony_ci
391cb0ef41Sopenharmony_ci#### `scope`
401cb0ef41Sopenharmony_ci
411cb0ef41Sopenharmony_ci* Default: the scope of the current project, if any, or ""
421cb0ef41Sopenharmony_ci* Type: String
431cb0ef41Sopenharmony_ci
441cb0ef41Sopenharmony_ciAssociate an operation with a scope for a scoped registry.
451cb0ef41Sopenharmony_ci
461cb0ef41Sopenharmony_ciUseful when logging in to or out of a private registry:
471cb0ef41Sopenharmony_ci
481cb0ef41Sopenharmony_ci```
491cb0ef41Sopenharmony_ci# log in, linking the scope to the custom registry
501cb0ef41Sopenharmony_cinpm login --scope=@mycorp --registry=https://registry.mycorp.com
511cb0ef41Sopenharmony_ci
521cb0ef41Sopenharmony_ci# log out, removing the link and the auth token
531cb0ef41Sopenharmony_cinpm logout --scope=@mycorp
541cb0ef41Sopenharmony_ci```
551cb0ef41Sopenharmony_ci
561cb0ef41Sopenharmony_ciThis will cause `@mycorp` to be mapped to the registry for future
571cb0ef41Sopenharmony_ciinstallation of packages specified according to the pattern
581cb0ef41Sopenharmony_ci`@mycorp/package`.
591cb0ef41Sopenharmony_ci
601cb0ef41Sopenharmony_ciThis will also cause `npm init` to create a scoped package.
611cb0ef41Sopenharmony_ci
621cb0ef41Sopenharmony_ci```
631cb0ef41Sopenharmony_ci# accept all defaults, and create a package named "@foo/whatever",
641cb0ef41Sopenharmony_ci# instead of just named "whatever"
651cb0ef41Sopenharmony_cinpm init --scope=@foo --yes
661cb0ef41Sopenharmony_ci```
671cb0ef41Sopenharmony_ci
681cb0ef41Sopenharmony_ci
691cb0ef41Sopenharmony_ci
701cb0ef41Sopenharmony_ci### See Also
711cb0ef41Sopenharmony_ci
721cb0ef41Sopenharmony_ci* [npm adduser](/commands/npm-adduser)
731cb0ef41Sopenharmony_ci* [npm registry](/using-npm/registry)
741cb0ef41Sopenharmony_ci* [npm config](/commands/npm-config)
751cb0ef41Sopenharmony_ci* [npm whoami](/commands/npm-whoami)
76