The CLI login command
The Sitecore CLI includes a login command that allows developers to log in to a Sitecore instance.
To authenticate against a Sitecore Experience Manager (XM) Cloud instance, use the cloud login command provided by the XM Cloud plugin.
Usage
The Sitecore CLI login command is initiated within the Sitecore CLI by using the following:
Options
You can use the following options with the login command:
-
--authority,--auth: not required. Identity authority for the environment, such as identity server or AAD tenant URL. -
--audience: not required. The unique identifier of the audience that issued the token. -
--environment,-n: not required. Named Sitecore environment to use. Default:default. -
--cm: not required. Sitecore content management hostname to connect to. -
--allow-write: not required. Enable writing data to the environment. -
--client-credentials: not required. Use client credentials (for CI/CD, shared secret). -
--client-id: not required. The OAuth ClientID to send. Defaults toDevicefor device auth, andSitecoreCLIServerfor client credentials. -
--client-secret: not required. The OAuth client secret to send. Only used for client credentials authentication. -
--config,-c: not required. Path to the rootsitecore.jsondirectory. Default: current working directory. -
--help,-h,-?: not required. Display developer help and usage information about the command. -
--trace,-t: not required. Outputs additional diagnostics and detailed information about the command. -
--insecure,-k: not required. Allows using an insecure (http) authority URL. Only applicable with the client credentials flow (--client-credentials true). Available in version 4.1.0 and later. -
--ref,-r: not required. Log in to an existing environment and use its credentials. Requires that you provide the--cmand--allow-writeparameters.For example:
Examples
The following are examples of using the login command for interactive user login:
Output:
The following are examples of using the login command for noninteractive user login:
- Use the non-interactive client login:
- Bypass the
httpsprotocol restriction:
For more information, refer to logging in to a Sitecore instance using the CLI.