Ping SDKs

Before you begin

Step 1. Downloading the samples

You need to download the SDK sample apps repo, which contains the projects you will use for this tutorial.

  1. In a web browser, navigate to the SDK Sample Apps repository.

  2. Download the source code using one of the following methods:

    Download a ZIP file
    1. Click Code, and then click Download ZIP.

    2. Extract the contents of the downloaded ZIP file to a suitable location.

    Use a Git-compatible tool to clone the repo locally
    1. Click Code, and then copy the HTTPS URL.

    2. Use the URL to clone the repository to a suitable location.

      For example, from the command-line you could run:

      git clone https://github.com/ForgeRock/sdk-sample-apps.git
      shell

The result of these steps is a local folder named sdk-sample-apps.

Step 2. Installing the dependencies

In the following procedure, you install the required modules and dependencies, including the Ping SDK for JavaScript.

  1. In a terminal window, navigate to the sdk-sample-apps/javascript folder.

  2. To install the required packages, enter the following:

    npm install
    shell

    The npm tool downloads the required packages, and places them inside a node_modules folder.

Step 3. Hosting the sample apps

In a production scenario your custom login UI app would have its own fully-qualified domain name that your Android, iOS, and JavaScript clients could all connect to.

For simplicity, in this tutorial you will serve your custom login UI app from the local IP address of your host computer.

Using the local IP of your host computer means Android and iOS apps running on a simulator can resolve the address, and also JavaScript apps running locally.

Obtaining your local IP address

Complete the following steps to obtain your local IP address:

  1. In a command prompt, enter ipconfig /all

    Windows displays information about the network adapters in your computer.

    Show example output
    Windows IP Configuration
       Host Name . . . . . . . . . . . . : Windows
       Primary Dns Suffix  . . . . . . . :
       Node Type . . . . . . . . . . . . : Hybrid
       IP Routing Enabled. . . . . . . . : No
       WINS Proxy Enabled. . . . . . . . : No
    
    Ethernet adapter Ethernet:
       Media State . . . . . . . . . . . : Media disconnected
       Description . . . . . . . . . . . : E3100G 2.5 Gigabit Ethernet Controller
       Physical Address. . . . . . . . . : 74-34-E2-2b-30-44
       DHCP Enabled. . . . . . . . . . . : Yes
       Autoconfiguration Enabled . . . . : Yes
    
    Wireless LAN adapter Local Area Connection* 1:
       Media State . . . . . . . . . . . : Media disconnected
       Description . . . . . . . . . . . : Microsoft Wi-Fi Direct Virtual Adapter
       Physical Address. . . . . . . . . : 67-6C-EB-B3-46-82
       DHCP Enabled. . . . . . . . . . . : Yes
       Autoconfiguration Enabled . . . . : Yes
    
    Wireless LAN adapter Wi-Fi:
       Description . . . . . . . . . . . : Wireless Network Adapter (210NGW)
       Physical Address. . . . . . . . . : 87-6C-DF-C9-17-90
       DHCP Enabled. . . . . . . . . . . : Yes
       Autoconfiguration Enabled . . . . : Yes
       IPv6 Address. . . . . . . . . . . : 2406:3d08:2f61:1400::2d47
       Lease Obtained. . . . . . . . . . : January 27, 2025 11:09:26 AM
       Lease Expires . . . . . . . . . . : January 28, 2025 6:09:26 AM
       IPv6 Address. . . . . . . . . . . : 2406:3d08:2f61:1400::2d47
       Temporary IPv6 Address. . . . . . : 2604:2b08:2f93:2600:b479:b5b4:25ff:acc8
       Link-local IPv6 Address . . . . . : fe54::d9e5:16ff:d9d4:e22%10
       IPv4 Address. . . . . . . . . . . : 192.168.0.35
       Subnet Mask . . . . . . . . . . . : 255.255.255.0
       Lease Obtained. . . . . . . . . . : January 27, 2025 11:09:24 AM
       Lease Expires . . . . . . . . . . : January 29, 2025 11:09:26 AM
       Default Gateway . . . . . . . . . : fe80::bb8:c0ee:fea5:8c58%10
                                           192.168.0.1
       DHCP Server . . . . . . . . . . . : 192.168.0.1
       DHCPv6 IAID . . . . . . . . . . . : 893252287
       DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-1b-87-59-2D-74-86-C4-3C-30-88
       DNS Servers . . . . . . . . . . . : 2025:4e8:0:230b::11
                                           2025:4e8:0:230c::11
                                           8.8.8.8
       NetBIOS over Tcpip. . . . . . . . : Enabled
  2. Ignoring adapters where the Media State property is listed as Media Disconnected, locate the ethernet or wireless adapter that connects to your router.

  3. Make a note of the IPv4 Address field.

    The address will often start with 192.168., 10.0., or 172.16., which are the first digits of the commonly used reserved private IPv4 addresses.

    In this case, the local IPv4 IP address is 192.168.0.35.

    You will use this address to access your custom UI app for this tutorial.

Creating a DNS alias for the JavaScript client application

You should assign a DNS alias to your localhost address to help differentiate the client application from the custom UI application during this tutorial.

You can choose whatever host name you prefer for your client application. This tutorial uses sdkapp.example.com.

Complete the following steps to configure a DNS alias for your local IP address:

  1. As an administrator, in a text editor open the %SystemRoot%\system32\drivers\etc\hosts file.

  2. Add the following:

    127.0.0.1 sdkapp.example.com

  3. Close and save the file.