Log in with the Content Hub CLI
To log in to your Sitecore Content Hub instance, run the following command:
ch-cli endpoint add --name <NAME> --url <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 lets you 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.
If you have the necessary permissions, you can see these values in Content Hub. Go to Manage > OAuth clients and, in the list, click CLI.
The login command redirects you to the specified Content Hub instance, where you can grant permissions to the client. The default redirect URI is http://localhost:9000/
, but you can override this by adding the --redirect-uri
parameter to your command as shown in the following example:
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/>
The value of --redirect-uri
must match the redirect URL of your OAuth client exactly.