dhei/classic-tokens
@reggi/path-to-regexp
dependabot/npm_and_yarn/main/copy-to-clipboard-4.0.2
dependabot/npm_and_yarn/main/eslint-10.4.0
dependabot/npm_and_yarn/main/npmcli/eslint-config-7.0.0
dependabot/npm_and_yarn/main/proc-log-7.0.0
dependabot/npm_and_yarn/npm_and_yarn-826852524d
dependabot/npm_and_yarn/npm_and_yarn-ab9a7f4bc2
deprecate-totp-2fa
dhei/classic-tokens
gat-bypass-2fa-docs
jpg619/fix-accessibility-content-flow
jpg619/version-bump-tar-2
kartykp/gat-bypass-2fa-docs
kartykp/upgrade-path-to-regex
main
maitxn/version-bump-tar
patch-1
reggi/cache-based-on-version
reggi/dev-engines
reggi/fix-transform-prettier
reggi/overrides
update-search-sensitivity
| 1 | --- |
| 2 | title: npm-logout |
| 3 | section: 1 |
| 4 | description: Log out of the registry |
| 5 | github_repo: npm/cli |
| 6 | github_branch: release/v10 |
| 7 | github_path: docs/lib/content/commands/npm-logout.md |
| 8 | redirect_from: |
| 9 | - /cli-documentation/v10/cli-commands/logout |
| 10 | - /cli-documentation/v10/cli-commands/npm-logout |
| 11 | - /cli-documentation/v10/commands/logout |
| 12 | - /cli-documentation/v10/commands/npm-logout |
| 13 | - /cli-documentation/v10/logout |
| 14 | - /cli-documentation/v10/npm-logout |
| 15 | - /cli/v10/cli-commands/logout |
| 16 | - /cli/v10/cli-commands/npm-logout |
| 17 | - /cli/v10/commands/logout |
| 18 | - /cli/v10/logout |
| 19 | - /cli/v10/npm-logout |
| 20 | --- |
| 21 | |
| 22 | ### Synopsis |
| 23 | |
| 24 | ```bash |
| 25 | npm logout |
| 26 | ``` |
| 27 | |
| 28 | Note: This command is unaware of workspaces. |
| 29 | |
| 30 | ### Description |
| 31 | |
| 32 | When logged into a registry that supports token-based authentication, tell the server to end this token's session. This will invalidate the token everywhere you're using it, not just for the current environment. |
| 33 | |
| 34 | When logged into a legacy registry that uses username and password authentication, this will clear the credentials in your user configuration. In this case, it will _only_ affect the current environment. |
| 35 | |
| 36 | If `--scope` is provided, this will find the credentials for the registry connected to that scope, if set. |
| 37 | |
| 38 | ### Configuration |
| 39 | |
| 40 | #### `registry` |
| 41 | |
| 42 | - Default: "https://registry.npmjs.org/" |
| 43 | - Type: URL |
| 44 | |
| 45 | The base URL of the npm registry. |
| 46 | |
| 47 | #### `scope` |
| 48 | |
| 49 | - Default: the scope of the current project, if any, or "" |
| 50 | - Type: String |
| 51 | |
| 52 | Associate an operation with a scope for a scoped registry. |
| 53 | |
| 54 | Useful when logging in to or out of a private registry: |
| 55 | |
| 56 | ``` |
| 57 | # log in, linking the scope to the custom registry |
| 58 | npm login --scope=@mycorp --registry=https://registry.mycorp.com |
| 59 | |
| 60 | # log out, removing the link and the auth token |
| 61 | npm logout --scope=@mycorp |
| 62 | ``` |
| 63 | |
| 64 | This will cause `@mycorp` to be mapped to the registry for future installation of packages specified according to the pattern `@mycorp/package`. |
| 65 | |
| 66 | This will also cause `npm init` to create a scoped package. |
| 67 | |
| 68 | ``` |
| 69 | # accept all defaults, and create a package named "@foo/whatever", |
| 70 | # instead of just named "whatever" |
| 71 | npm init --scope=@foo --yes |
| 72 | ``` |
| 73 | |
| 74 | ### See Also |
| 75 | |
| 76 | - [npm adduser](/cli/v10/commands/npm-adduser) |
| 77 | - [npm registry](/cli/v10/using-npm/registry) |
| 78 | - [npm config](/cli/v10/commands/npm-config) |
| 79 | - [npm whoami](/cli/v10/commands/npm-whoami) |