The CLI login command
Describes the DevEx CLI login command that authorizes plugins containing additional CLI commands to perform operations in a Sitecore instance.
The Sitecore CLI includes a login
command that allows developers to log in to a Sitecore instance.
Note
To authenticate against a Sitecore Experience Manager (XM) Cloud instance, use the cloud login
command provided by the XM Cloud plugin.
The Sitecore CLI login
command is initiated within the Sitecore CLI by using the following:
dotnet sitecore login [options]
You can use the following options with the login
command:
Option | Required | Description |
---|---|---|
| No | Identity authority for the environment, such as identity server or AAD tenant URL. |
| No | The unique identifier of the audience that issued the token. |
| No | Named Sitecore environment to use. Default: |
| No | Sitecore content management hostname to connect to. |
| No | Enable writing data to the environment. |
| No | Use client credentials (for CI/CD, shared secret). |
| No | The OAuth ClientID to send. Defaults to |
| No | The OAuth client secret to send. Only used for client credentials authentication. |
| No | Path to the root |
| No | Display developer help and usage information about the command. |
| No | Outputs additional diagnostics and detailed information about the command. |
| No | Allows using an insecure ( |
| No | Log in to an existing environment and use its credentials. Requires that you provide the For example: |
The following are examples of using the login
command for interactive user login:
Command | Result |
---|---|
dotnet sitecore login --authority https://<sitecore identity server> --cm https://<sitecore instance> --allow-write true dotnet sitecore login | Output: Logging in to Sitecore. You should see a browser window open shortly. [DeviceLogin] User Code : 1234 [DeviceLogin] Authentication url : https://<sitecore identity server>/device?userCode=1234 [DeviceLogin] Authorization pending. Waiting. [DeviceLogin] Authorization pending. Waiting. Your login is complete. You can close the browser tab now. Login information has been saved. |
The following are examples of using the login
command for noninteractive user login:
Command | Description |
---|---|
dotnet sitecore login --authority https://<sitecore identity server> --cm https://<sitecore instance> --allow-write true --client-credentials true --client-id <client id> --client-secret <client secret> | Use the non-interactive client login. |
dotnet sitecore login --cm https://<sitecore instance> --auth http://<sitecore identity server> --allow-write true --client-id <client id> --client-secret <client secret> --client-credentials true --insecure | Bypass the |
For more information, refer to logging in to a Sitecore instance using the CLI.