Skip to main content

Configure Projects with Ory CLI

All Ory components use the same configuration format and APIs when they are self-hosted or consumed through Ory Cloud.

This allows you to use the Ory CLI to configure your components, no matter how you use Ory!

note

Ory CLI is actively developed. This means that more configuration options are added with new CLI releases.

Creating Projects​

With Ory CLI, you can create a new Ory Cloud account and project from your terminal.

To start, run this command to start the wizard:

ory auth

If you haven't signed in with the CLI before, you're asked if you have an Ory Cloud account.

Do you already have an Ory Console account you wish to use? [y/n]: n

Answer "no" to create a new account. In the process, you must provide the basic account information: email address, password, user name, and choose if you want to be informed about platform security updates.

As a final step, accept the Terms of Service.

I accept the Terms of Service https://www.ory.sh/ptos:  [y/n]: y

When the process is completed, the CLI displays the created project and user details:

You are now signed in as: tom@email.com
ID cae666dg-2ffa-491b-9912-6b090ec10e1c
EMAIL tom@email.com
SELECTED_PROJECT 00000000-0000-0000-0000-00000000000

Using Existing Projects​

To use the CLI with your existing Ory Cloud account and project, run this command to sign in:

ory auth

Follow the on-screen instructions to sign in to your account. Upon successful sign in, the CLI shows the details of the signed-in user and the selected Ory Cloud project:

You are now signed in as: john.wick@company.com
ID 7759555-e23a-44b7-b148-7fed7f908024
EMAIL john.wick@company.com
SELECTED_PROJECT 00000000-0000-0000-0000-000000000000

Accounts with Social Sign-In​

If you created your account through a social sign-in provider such as GitHub or Google, you must adjust your account configuration to use the Ory CLI.

Accounts created with social sign-in providers don't use passwords. To sign in to your account with the Ory CLI, you must provide your email address and password.

Follow these steps to create a password for an account created with a social sign-in provider:

  1. Open the Ory Console and sign in.
  2. Go to your account settings.
  3. Enter a new password in the Update Password field.
  4. Click Save to finish.

Configuring Projects​

There are two ways to adjust the configuration of Ory Cloud projects. You can:

  • overwite / import configuration from a file using the ory update command
  • patch the existing configuration using the ory patch command

Overwrite / Import Configuration​

To overwrite the entire project configuration or to import a brand new config, create a file with the configuration you want to use.

The configuration format follows the updateProject API request payload.

note

The /services/identity/config key is compatible with the Ory Kratos configuration format except for some keys (for example serve, dsn) which will be ignored.

{
"services": {
"identity": {
"config": ...
}
}
}

Let's look at an example. If you want to change the name of the email sender for recovery and verification emails, create a configuration file that looks like this:

config.json
{
"name": "My Project Name"
"services": {
"identity": {
"config": {
"courier": {
"smtp": {
"from_name": "My Custom E-Mail Name"
}
}
}
}
}
}

Next, use the Ory CLI to apply the config:

ory update project <your-project-id> --file config.json

Patch Configuration​

When you want to change specific parts of the configuration instead of overwriting the entire config, use the ory patch command.

Use this command in combination with JSON Patch to target individual keys.

To perform an update similar to the one described in the previous paragraph and change the name of the email sender for recovery and verification emails, run this command:

ory patch project <your-project-id> \
--replace '/services/identity/config/courier/smtp/from_name="My Custom E-Mail Name"'

Use the --replace flag to indicate the key you want to change.

tip

Note that the part after = is interpreted as raw JSON:

  • String: /path/to/key="my string"
  • Bool: /path/to/key=true
  • Number: /path/to/key=123
  • Complex: /path/to/key={"my": ["vaules", {"foo":"bar"}]}