The PhoneCheck, SubscriberCheck, and SIMCheck products are all mobile-first products. The purpose of the "Setup Your Environment" guide is to provide you with everything needed before creating one of the three Checks.
The tru.ID CLI enables developers to control their projects via command line, they're also able to build integrations into existing development workflows, via scripts without the need for an IDE.
With Node.js installed you install the tru.ID CLI as follows:
npm install -g @tru_id/cli
tru command is installed, log your CLI in with your tru.ID account (replacing
YOUR_IDENTITY_PROVIDER with either
tru login YOUR_IDENTITY_PROVIDER
Create a Project
Projects are configuration containers within the tru.ID platform and you'll normally have a one-to-one mapping of a tru.ID project to an application that you are developing (though you may also create a project per environment: dev, staging and prod). A key piece of configuration are the project credentials which contain a
client_id`` and client_secret` that you use to authenticate interactions with the tru.ID APIs.
You create projects using the CLI:
tru projects:create "My Project"
And you'll see output such as:
Creating Project "My Project"Project configuration saved to "~/my_project/tru.json".
tru.json file contains your project configuration including the project credentials. This file should not be commited to your version control!
With a project created you can
cd my_project so the CLI can read the
tru.json file from the
cwd and you have everything you need to fully utilise the tru.ID CLI.
The Demo Development server
The development server is an example server written in Node.js to provide a working example for developers to create PhoneCheck or SubscriberCheck with minimal configuration. This server has been created only for demonstration purposes and should not be adopted for release into production for your product. The purpose of a backend server such as the functionality shown in the demo server is to:
- Allow communication between the mobile device and the server itself
- Make requests to tru.ID's APIs in a secure manner for the mobile device, such as create a PhoneCheck using your Project's credentials without the risk of these credentials being intercepted
dev-server can be cloned directly from the tru.ID GitHub repository, in your Terminal running the following command:
git clone email@example.com:tru-ID/dev-server.git
Then in your Terminal navigate into the
dev-server directory and run the following command:
npm install# oryarn install
You can currently provide your Project's credentials in one of two ways:
- Rename .env.example to .env, and update the
TRU_ID_CLIENT_SECRETvalues to be your own Project's values.
- or move the
tru.jsonfile into the
Note: it is bad security practice to commit your credentials into your repository, whether it's a
tru.jsonfile or hard coded into your project.
To run the dev-server you can run the following command in your Terminal:
npm start# oryarn start