<@U04UQ68083H> can I create a hydra client via the...
# ory-copilot
q
@chilly-king-10285 can I create a hydra client via the cli tool in the docker container and set the client id myself?
b
A message from kapa.ai
Yes, you can create a Hydra client via the CLI tool in the Docker container. However, the client ID is not something you can set yourself. It is automatically generated when you create the client. Here is an example of how you can create a client using the Hydra CLI tool in a Docker container:
Copy code
bash docker-compose -f quickstart.yml exec hydra \     hydra create client \     --endpoint <http://127.0.0.1:4445> \     --grant-type authorization_code,refresh_token \     --response-type code,id_token,email \     --scope openid,offline_access,profile,email \     --redirect-uri <http://gitlab.example.com:8000/users/auth/Ory_Hydra/callback> \     --token-endpoint-auth-method client_secret_post
After creating the client, you can extract the client ID and client secret using the
jq
tool:
Copy code
bash client_id=$(echo $client | jq -r '.client_id') client_secret=$(echo $client | jq -r '.client_secret')
Please note that the
--endpoint
flag should be set to the administrative API endpoint of your Ory Hydra server. For more information, you can refer to the [Ory Hydra documentation](https://www.ory.sh/docs/hydra/cli/hydra-create-client).
q
@chilly-king-10285 is it possible to change it after client creation?
b
A message from kapa.ai
No, it's not possible to change the client ID after the client has been created. The client ID is an immutable identifier generated by the server. Once a client ID is assigned to a client, it cannot be changed. This is stated in the [Ory API Reference](https://www.ory.sh/docs/reference/api): > 'client_id': {'description': 'OAuth 2.0 Client ID\n\nThe ID is immutable. If no ID is provided, a UUID4 will be generated.', 'type': 'string'} However, you can update other details of the client using the
hydra update client
command. For example, you can update the client name, grant types, response types, and other parameters. Here's an example:
Copy code
bash hydra update client <client-id-here> -c <http://localhost/cb> -g authorization_code -r code -a core,foobar
For more information, you can refer to the [Ory Hydra documentation](https://www.ory.sh/docs/hydra/cli/hydra-update-client).