# org logout

Log out of a Salesforce org.

## Description for org logout

If you run this command with no flags and no default org set in your config or environment, it first displays a list of orgs you've created or logged into, with none of the orgs selected. Use the arrow keys to scroll through the list and the space bar to select the orgs you want to log out of. Press Enter when you're done; the command asks for a final confirmation before logging out of the selected orgs.

The process is similar if you specify --all, except that in the initial list of orgs, they're all selected. Use --target-org to logout of a specific org. In both these cases by default, you must still confirm that you want to log out. Use --no-prompt to never be asked for confirmation when also using --all or --target-org.

Be careful! If you log out of a scratch org without having access to its password, you can't access the scratch org again, either through the CLI or the Salesforce UI.

Use the --client-app flag to log out of the link you previously created between an authenticated user and a connected app or external client app; you create these links with "org login web --client-app". Run "org display" to get the list of client app names.

## Aliases for org logout

`force:auth:logout`

`auth:logout`

## Flags

| Flag Name (Long) | Flag Name (Short) | Description                                                                                                                                                            |
| ---------------- | ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--all`          | `-a`              | **Type:** Boolean<br><br>Include all authenticated orgs.<br><br>All orgs includes Dev Hubs, sandboxes, DE orgs, and expired, deleted, and unknown-status scratch orgs. |
| `--client-app`   | `-c`              | **Type:** Value<br><br>Client app to log out of.                                                                                                                       |
| `--flags-dir`    | N/A               | **Type:** Value<br><br>Import flag values from a directory.                                                                                                            |
| `--json`         | N/A               | **Type:** Boolean<br><br>Format output as json.                                                                                                                        |
| `--no-prompt`    | `-p`              | **Type:** Boolean<br><br>Don't prompt for confirmation.                                                                                                                |
| `--target-org`   | `-o`              | **Type:** Value<br><br>Username or alias of the target org.                                                                                                            |

## Examples for org logout

Interactively select the orgs to log out of:

```shell
sf org logout
```

Log out of the org with username <me@my.org>:

```shell
sf org logout --target-org me@my.org
```

Log out of all orgs after confirmation:

```shell
sf org logout --all
```

Logout of the org with alias my-scratch and don't prompt for confirmation:

```shell
sf org logout --target-org my-scratch --no-prompt
```
