Using Auth0 CLI with Private Cloud

The Auth0 CLI is a handy tool to help with designing and building your Auth0 experience. It lets you do a number of things including:

  • Testing your universal login flow: Emulate your end users’ login experience by running auth0 test login.
  • Troubleshooting in real-time: Inspect the events of your Auth0 integration as they happen with the auth0 logs tail command.
  • Simplifying repetitive tasks: Create, update, list and delete your Auth0 resources directly from the terminal.

The Auth0 CLI has a simple interactive logging flow that lets you login as a user and it is powered by the device authorization flow. Unfortunately, this simple login experience isn’t supported if you’re in an Auth0 Private Cloud instead you’ll need to authenticate as a machine using a client credentials flow. The steps to connect to a private cloud tenant are as follows:

  1. Create a new M2M application in the tenant. Note: When creating the application be sure to follow the principal of least privilege and be careful with the scopes that you grant the application.
  1. From your application copy the Domain, Client ID and Client secret and copy them into the command below.
auth0 login --domain <tenant domain> --client-id < M2M application client ID> --client-secret < M2M Client Secret >
  1. Once the command is executed you should get a successfully logged in message like the below
  1. After, successfully logging in to the tenant you will need to use the auth0 tenants use <tenant domain> command to begin using the cli with the private cloud tenant.
  1. You can now freely execute commands like auth0 test login as shown below.

Leave a Reply