1--- 2title: npm-logout 3section: 1 4description: Log out of the registry 5--- 6 7### Synopsis 8 9```bash 10npm logout 11``` 12 13Note: This command is unaware of workspaces. 14 15### Description 16 17When logged into a registry that supports token-based authentication, tell 18the server to end this token's session. This will invalidate the token 19everywhere you're using it, not just for the current environment. 20 21When logged into a legacy registry that uses username and password 22authentication, this will clear the credentials in your user configuration. 23In this case, it will _only_ affect the current environment. 24 25If `--scope` is provided, this will find the credentials for the registry 26connected to that scope, if set. 27 28### Configuration 29 30#### `registry` 31 32* Default: "https://registry.npmjs.org/" 33* Type: URL 34 35The base URL of the npm registry. 36 37 38 39#### `scope` 40 41* Default: the scope of the current project, if any, or "" 42* Type: String 43 44Associate an operation with a scope for a scoped registry. 45 46Useful when logging in to or out of a private registry: 47 48``` 49# log in, linking the scope to the custom registry 50npm login --scope=@mycorp --registry=https://registry.mycorp.com 51 52# log out, removing the link and the auth token 53npm logout --scope=@mycorp 54``` 55 56This will cause `@mycorp` to be mapped to the registry for future 57installation of packages specified according to the pattern 58`@mycorp/package`. 59 60This will also cause `npm init` to create a scoped package. 61 62``` 63# accept all defaults, and create a package named "@foo/whatever", 64# instead of just named "whatever" 65npm init --scope=@foo --yes 66``` 67 68 69 70### See Also 71 72* [npm adduser](/commands/npm-adduser) 73* [npm registry](/using-npm/registry) 74* [npm config](/commands/npm-config) 75* [npm whoami](/commands/npm-whoami) 76