May 23, 2022

Introducing the tru.ID CLI updates

Greg Holmes
Developer Advocate
Try out Tru.ID

Make your first phone check in 1 minute. No app required to test. Get started for free.

Follow us on

tru.ID's success depends on you, the developer, being successful. As previously stated, all of our developer tools are open-source and available to you. The tru.ID CLI is one of these tools, and today we've released a new version with several changes to make implementing SIM-based authentication with tru.ID even easier.

What are the updates?

The latest version of the tru.ID CLI contains several updates. These are summarised in the following bullet points and further explained in their own sections below:

  • oAuth2 support has been added to support your CLI setup and authentication of your account.
  • The `dev-server` has been removed as a feature in the CLI.
  • `--workflow` has been removed from the PhoneCheck (`phonechecks:create`) and SubscriberCheck (`subscriberchecks:create`) creation commands.

Authentication

In the previous version, the CLI only supported authentication with your workspace credentials (`client_credentials` grant), which you would have configured when running the command `tru setup`.

With the new version (v1.0.5), we've replaced this with `tru login`. You will need to enter the Identity Provider of your choosing from Google, GitHub, or Microsoft. Using this new functionality, you don't need to find your credentials, but instead, use your trusted identity provider.

The Dev-Server command removal

With the PhoneCheck and SubscriberCheck API updates to version 0.2, more configuration is required for the developer demo server, and the decision was made to remove this feature as a plugin for the CLI and keep it as an independent repository. If you still wish to continue using the developer demo server, please clone the repository on GitHub.

How can I use the CLI?

Install

To install the CLI, you need npm (minimum version 14.0.0) installed locally on your machine; then in your Terminal, run the following command:

$ npm install -g @tru_id/cli

Before you can access anything with the CLI, you need to let it know who you are. You can log in with the following command, but be sure to choose the Identity Provider you chose when creating an account on tru.ID:

tru login {github|microsoft|google}

Workspaces

A workspace is a container for users' accounts and billing accounts. There are two different kinds of workspaces you can belong to, and these are:

  • If you signed up to tru.ID on your own, you will have a workspace created for you. By default, you are the owner of this workspace — i.e. you'll have full control of the projects and billing.
  • If you signed up to tru.ID through an invitation from another tru.ID user, you will by default join their workspace with the access level they have granted you — this could either be an admin or viewer. In addition, you will also have a separate workspace that you are the owner of.

You can view which workspaces you're a member of by running the command:

tru workspaces:list

You will need to choose which one is to be the active workspace for your CLI with the following command:

tru workspaces:switch {workspace_id}

Projects

A project is a method for applications to access tru.ID APIs. A project serves two purposes:

  • To provide credentials. Each user within the workspace will need to generate their credentials, removing the need to share credentials for a project.
  • To logically group API calls. Having separate projects for specific purposes or applications increases security and improves tracking over the usage of each project.

With the CLI, you can carry out three commands for projects. These are listed in the examples below:

tru projects:create # to create a new Project
tru projects:list # lists the details for all Projects or Projects that match a given criteria
tru projects:update # updates an existing Project

For more information on how to set up your environment for using tru.ID APIs, please check out the Set up your Environment page on the tru.ID Developer Docs.