ForgeRock Developer Experience

Step 3. Configure a sample app

In this tutorial, you configure a sample app provided in the ForgeRock JavaScript SDK to connect to the authentication tree/journey you created when setting up your server configuration.

Configuration properties define how the SDK connects to the ForgeRock Identity Platform.

The table below lists the properties that this tutorial requires.

You can click on a value in the Example column and enter your own custom value.

The documentation displays your custom value whenever it is required, rather than the default.

SDK configuration properties
Property Description Example


The client_id of the OAuth 2.0 client profile to use.



A space-separated list of scopes to request when performing an OAuth 2.0 authorization flow.

openid profile email address phone


An interface for configuring how the SDK contacts the AM server. The interface contains baseUrl and timeout.

serverConfig: {baseUrl}

The base URL of the AM instance to connect to, including port and deployment path.

serverConfig: {timeout}

A timeout, in milliseconds, for each request that communicates with AM.

For example, for 5 seconds, specify 5000.


The redirect_uri as configured in the OAuth 2.0 client profile.


The realm or realm path in which the tree is configured. The default is the top-level realm; root).


To configure the tutorial sample

  1. In Terminal, open the forgerock-javascript-sdk project created earlier.

  2. Navigate to samples > embedded-login, and open the src/main.js file.

  3. In the main.js file, update the configuration settings as follows:

      clientId: 'sdkPublicClient',
      redirectUri: '',
      scope: 'openid profile email address phone',
      serverConfig: {
        baseUrl: '',
        timeout: 5000
      realmPath: 'alpha', // Self-managed AM: 'root', Cloud AM: 'alpha' or 'beta'.
      tree: 'Login',

You will see these values are populated in the embedded login with process.env.VARIABLE_NAME.

You can choose to leverage the .env.example file in the folder by making a copy in the same directory called .env, and updating the values there. Alternatively, replace the values with your settings directly in the config object as above.

Copyright © 2010-2024 ForgeRock, all rights reserved.