Newer Version Available

This content describes an older version of this product. View Latest

Log Out of an Org

For security purposes, you can use the Salesforce CLI to log out of any org you’ve previously authorized. This practice prevents other users from accessing your orgs if you don’t want them to.

The only way to access an org after you log out of it is with a password. By default, new scratch orgs contain one administrator with no password. Therefore, to access a scratch org again after you log out of it, set a password for at least one user. Otherwise, you lose all access to the scratch org. If you don’t want to access the scratch org again, rather than log out of it, we recommend that you delete it with force:org:delete.

Important

To log out of an org, use force:auth:logout. This example uses the alias my-hub-org to log out.

1sfdx force:auth:logout --targetusername my-hub-org

To log out of all your orgs, including scratch orgs, use the --all parameter.

1sfdx force:auth:logout --all

To access an org again, other than a scratch org, reauthorize it.

When you log out of an org, it no longer shows up in the force:org:list output. If you log out of a Dev Hub org, the associated scratch orgs show up only if you specify the --all parameter.