Setup Your Environment

Setup Your Environment
info

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.

IDlayr CLI

The IDlayr 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 IDlayr CLI as follows:

npm install -g @tru_id/cli

Once the tru command is installed, log your CLI in with your IDlayr account (replacing YOUR_IDENTITY_PROVIDER with either google, microsoft, or github):

tru login YOUR_IDENTITY_PROVIDER

Create a Project

Projects are configuration containers within the IDlayr platform and you'll normally have a one-to-one mapping of a IDlayr 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 IDlayr 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".

The 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 IDlayr 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 IDlayr'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

The dev-server can be cloned directly from the IDlayr GitHub repository, in your Terminal running the following command:

git clone [email protected]:tru-ID/dev-server.git

Then in your Terminal navigate into the dev-server directory and run the following command:

npm install
# or
yarn 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_ID and TRU_ID_CLIENT_SECRET values to be your own Project's values.
  • or move the tru.json file into the dev-server directory.

Note: it is bad security practice to commit your credentials into your repository, whether it's a .env, a tru.json file or hard coded into your project.

To run the dev-server you can run the following command in your Terminal:

npm start
# or
yarn start
Download our Developer Console mobile app
Made withacross the 🌍
© 2024 4Auth Limited. All rights reserved. IDlayr is the trading name of 4Auth Limited.