1 ---
2 title: npm-logout
3 section: 1
4 description: Log out of the registry
5 github_repo: npm/cli
6 github_branch: release/v9
7 github_path: docs/lib/content/commands/npm-logout.md
8 redirect_from:
9 - /cli-documentation/v9/cli-commands/logout
10 - /cli-documentation/v9/cli-commands/npm-logout
11 - /cli-documentation/v9/commands/logout
12 - /cli-documentation/v9/commands/npm-logout
13 - /cli-documentation/v9/logout
14 - /cli-documentation/v9/npm-logout
15 - /cli/v9/cli-commands/logout
16 - /cli/v9/cli-commands/npm-logout
17 - /cli/v9/commands/logout
18 - /cli/v9/logout
19 - /cli/v9/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/v9/commands/npm-adduser)
77 - [npm registry](/cli/v9/using-npm/registry)
78 - [npm config](/cli/v9/commands/npm-config)
79 - [npm whoami](/cli/v9/commands/npm-whoami)