Handles the removing of authorizations, which includes deleting the auth file in the global .sfdx folder, deleting any configs that are associated with the username/alias, and deleting any aliases associated with the username

const remover = await AuthRemover.create();
await remover.removeAuth('example@mycompany.com');
const remover = await AuthRemover.create();
await remover.removeAllAuths();
const remover = await AuthRemover.create();
const auth = await remover.findAuth(
example@mycompany.com
);
await remover.removeAuth(auth.username);

Hierarchy

  • AsyncOptionalCreatable
    • AuthRemover

Constructors

  • Constructs a new AsyncCreatable instance. For internal and subclass use only. New subclass instances must be created with the static create method.

    Parameters

    • Optional options: object

      An options object providing initialization params.

    Returns AuthRemover

Methods

  • Finds authorization files for username/alias in the global .sfdx folder Throws SfError{ name: 'TargetOrgNotSetError' } if no target-org Throws SfError{ name: 'NamedOrgNotFoundError' } if specified user is not found

    Parameters

    • Optional usernameOrAlias: string

      username or alias of the auth you want to find, defaults to the configured target-org

    Returns Promise<AuthFields>

  • Removes all authentication files and any configs or aliases associated with them

    Returns Promise<void>

  • Removes the authentication and any configs or aliases associated with it

    Parameters

    • usernameOrAlias: string

      the username or alias that you want to remove

    Returns Promise<void>