Log in with the Content Hub ONE CLI
To use the Content Hub ONE CLI, you need the client credentials, which you can obtain from the app. In Content Hub ONE, on the menu bar, click Settings
and, in the INTEGRATION
section of the left pane, click OAuth client
, and then copy the commands from the CLI Command
section. There are two grant types, and both can be used to connect to tenants with the CLI.
-
Device
- this is the preferred option because actions are performed in the context of a user, while theclient credentials
option falls back to a system user. With this option, you are prompted to log in to your account in order to grant access to the client. -
Client credentials
- this option is recommended for CI/CD pipelines and other automation, because authorization occurs without user interaction.
Both options use the tenant add
command, which has following parameters:
-
organization-id
- the ID of the organization that the tenant is part of. -
tenant-id
- the ID of the tenant. -
client-id
- the OAuth client ID that you want to use for the authentication flow. -
client-secret
- the client secret for the specified OAuth client.
By default, tenant information is stored in the credential manager of the operating system (Credential Manager on Windows or Keychain on macOS). If there are problems accessing the store, set the following environment variable SC_CH_ONE_CLI_CREDENTIALS_FALLBACK=true
. You can see organization and tenant information in the Content Hub ONE app by clicking your avatar and then clicking your organization name. If you have an Admin role, to see the client ID and the client secret, on the menu bar, click Settings and, in the left pane, click OAuth client.
To see a list of tenants, use the list
command ch-one-cli tenant list
.
Device authorization
To log in to your Content Hub ONE instance using device authorization, run the following command:
ch-one-cli tenant add \
--organization-id <ORGANIZATION_ID> \
--tenant-id <TENANT_ID> \
--client-id <DEVICE_OAUTH_CLIENT_ID>
Client credentials authorization
To log in to your Content Hub ONE instance using client credentials, run the following command:
ch-one-cli tenant add \
--organization-id <ORGANIZATION_ID> \
--tenant-id <TENANT_ID> \
--client-id <CLIENT_CREDENTIALS OAUTH_CLIENT_ID> \
--client-secret <CLIENT_CREDENTIALS_OAUTH_CLIENT_SECRET>