Log in with the Content Hub CLI

Current version: 4.2

To log in to your Sitecore Content Hub instance, run the following command:

RequestResponseshell
ch-cli endpoint add --name <name> --url https://your.content.hub.url/ --client-id <OAuth client ID> --client-secret <OAuth client secret>

This command includes the following parameters:

  • name is a unique identifier that allows you to manage multiple connections to different instances (for example, staging and production or different projects and customers).
  • url is the base URL to your instance.
  • client-id is the OAuth client ID that you want to use for the authentication flow.
  • client-secret is the client secret for the specified OAuth client.
  • redirect-uri overrides the redirect URL to complete the authorization (optional).

The login command redirects you to the specified Content Hub instance, where you can grant permissions to the client. The default is http://localhost:9000/. You can override the default using the --redirect-uri argument as shown in the following example:

RequestResponseshell
ch-cli endpoint add --name <name> --url https://your.content.hub.url/ --client-id <OAuth client ID> --client-secret <OAuth client secret> --redirect-uri http://localhost:9123/
Important

The redirect URL of the OAuth client and the one in the CLI must match exactly.

Do you have some feedback for us?

If you have suggestions for improving this article,