This Guide will walk you through performing your first PhoneCheck within an iOS application using a Node.js server. It covers:
- Things you need before you begin
- Setting up the Node.js example server
- Setting up and run the iOS example application
- Performing a PhoneCheck on iOS
The final simplified application structure looks as follows:
tru-id-phonecheck-example├── app-example-ios│ ├── LICENSE.md│ ├── README.md│ ├── Sample│ └── Sample.xcodeproj└── phonecheck-server└── tru.json
And the running iOS application looks and works as follows:

For more detailed information on how the mobile application, the Node.js server and the tru.ID APIs work together see the PhoneCheck Integration guide.
1. Before you begin
In order to execute a PhoneCheck you'll need XCode installed, an Apple Developer account and a physical iOS device with an active SIM card.
To expose the locally running Node.js server to the running mobile application you'll require a local tunnel solution such as ngrok.
To run through the guide as a whole you'll need a tru.ID account. If you don't already have an account, sign up now.
The tru.ID tooling relies on the Node.js runtime. So please ensure you have the Node.js runtime installed.
Install and setup the tru.ID CLI
With Node.js install the tru.ID CLI (Command Line Interface) from your terminal.
$ npm install -g @tru_id/cli
During the installation you will be prompted for your tru.ID Default Credentials. These can be found within the tru.ID Console.
Welcome to the tru CLI! Let's start by configuring the CLIConfiguration values can be found via http://tru.id/console? Please provide your workspace `client_id` {enter your client_id}? Please provide your workspace `client_secret` {enter your client_secret}? Please provide your workspace data residency `eu`Thanks! Writing your updated configuration to {path_to}/config.json... done
Create a working directory
Create a directory that you will add the client and server example code to:
$ mkdir tru-id-phonecheck-example
And navigate into that directory:
$ cd tru-id-phonecheck-example
2. Setup the Node.js example server
The Node.js example server is used as an authority and sits between the React Native application and the tru.ID APIs.
Clone the Node.js Server Example
Clone the tru.ID Node.js example server into the phonecheck-server
directory:
$ git clone git@github.com:tru-ID/server-example-node.git phonecheck-server
Create a tru.ID project
Create a new tru.ID project and save the configuration to the phonecheck-server
directory:
$ tru projects:create "phonecheck-server" --project-dir=phonecheck-server
You will see output similar to the following:
Creating Project "phonecheck-server"Project configuration saved to "path_to/tru-id-phonecheck-example/phonecheck-server/tru.json"
The Node.js application will read your tru.id credentials from the tru.json
project configuration file.
Run the tru.ID example server
Navigate into the phonecheck-server
directory:
$ cd phonecheck-server
Install the application dependencies:
$ npm install
Run the application:
$ npm start
You will see output similar to the following indicating that the server application is running at http://localhost:8080
:
> tru-node-server@0.1.0 start> nodemon src/index.js[nodemon] 2.0.4[nodemon] to restart at any time, enter `rs`[nodemon] watching path(s): *.*[nodemon] watching extensions: js,mjs,json[nodemon] starting `node src/index.js`configuration:{project_id: '0055f3a3-6e06-4390-9048-4f5a9dfcbbd1',name: 'phonecheck-server',credentials: [{client_id: 'PROJECT_CLIENT_ID',client_secret: 'PROJECT_CLIENT_SECRET',created_at: '2021-01-11T15:44:14+0000',scopes: [Array]}],mode: 'live',created_at: '2021-01-11T15:44:14+0000'}Example app listening at http://localhost:8080
Create a local tunnel for your server
In order for your mobile application to be able to interact with the locally running server you'll need to setup a local tunnel. For this example we'll use ngrok.
Run ngrok
to create a local tunnel and to get a public URL which will be used in the mobile application configuration. Run the following command in a new terminal window:
$ ngrok http 8080
You will then see output similar to the following:
Session Status onlineAccount Phil Leggetter (Plan: Pro)Version 2.3.35Region United States (us)Web Interface http://127.0.0.1:4040Forwarding http://d88e00a17e1c.ngrok.io -> http://localhost:8080Forwarding https://d88e00a17e1c.ngrok.io -> http://localhost:8080Connections ttl opn rt1 rt5 p50 p900 0 0.00 0.00 0.00 0.00
Navigate to your ngrok HTTPS URL to ensure the server is accessible (https://d88e00a17e1c.ngrok.io
from the above output).
3. Setup the iOS example application
With the server running you can now setup and run the iOS application.
Clone and configure the iOS example application
Open a new terminal and ensure you are in the tru-id-phonecheck-example
working directory. Run the following command to clone the iOS example into a app-example-ios
directory:
$ git clone git@github.com:tru-ID/app-example-ios.git
Ensure your iOS device is connected via USB. Launch XCode, open app-example-ios/Sample.xcodeproj
and set your iOS device as your deployment target:
Open Sample.xcodeproj
in XCode, activate the Build Settings tab and check the following:
- Ensure that
Signing -> Development Team
is set correctly - Update
User-Defined -> MY_APP_SERVER_URL
to point to the ngrok URL of your running Node.js server
Install and run the iOS App
Select "Run" in XCode to install and run the application on your iOS device.
4. Perform a PhoneCheck
Enter your phone number including the country code and click "Verify my phone number". The application will look similar to the following:

With that, you've completed your first tru.ID PhoneCheck from an iOS application.
5. Resources
- PhoneCheck full integration guide
- Node.js server application on GitHub
- iOS example application on GitHub
- tru.ID SDK for iOS on GitHub
- PhoneCheck API Reference
6. Troubleshooting
No troubleshooting content at this time.