Step 4. Configure the sample
In this tutorial, you configure the custom UI sample from 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 custom UI sample requires the following configuration properties:
Property | Description |
---|---|
|
The |
|
The |
|
A space-separated list of scopes to request when performing an OAuth 2.0 authorization flow. |
|
An interface for configuring how the SDK contacts the AM server.
The interface contains |
|
The base URL of the AM instance to connect to, including port and deployment path.
For example, |
|
A timeout, in milliseconds, for each request that communicates with AM.
For example, for 30 seconds, specify |
|
The realm or realm path in which the tree is configured.
The default is the top-level realm; |
|
The name of the tree to use. |
To configure the custom UI sample
-
In Terminal, open the
forgerock-javascript-sdk
project created earlier. -
Navigate to samples > embedded-login, and open the
src/main.js
file. -
In the
main.js
file, update the configuration settings as follows:forgerock.Config.set({ clientId: 'sdkPublicClient', redirectUri: 'https://sdkapp.example.com:8443/callback', scope: 'openid profile email address phone me.read', serverConfig: { baseUrl: https://openam-forgerock-sdks.forgeblocks.com/am/, timeout: '5000' }, realmPath: alpha, // Self-managed AM: 'root', Cloud AM: 'alpha' or 'beta'. tree: '<Your_auth_tree>', });
You will see these values are populated in the embedded login with You can choose to leverage the |
Example: Self-managed configuration
forgerock.Config.set({
clientId: 'sdkPublicClient',
redirectUri: 'https://sdkapp.example.com:8443/callback',
scope: 'openid profile email address phone me.read',
serverConfig: {
baseUrl: 'https://openam.example.com:8443/openam',
timeout: '5000'
},
realmPath: 'root',
tree: 'sdkUsernamePasswordJourney',
});
Example: Cloud configuration
forgerock.Config.set({
clientId: 'sdkPublicClient',
redirectUri: 'https://sdkapp.example.com:8443/callback/',
scope: 'openid profile email address phone',
serverConfig: {
baseUrl: 'https://openam-forgerock-sdks.forgeblocks.com/am/',
timeout: '5000' // 90000 or less
},
realmPath: 'alpha',
tree: 'sdkUsernamePasswordJourneyNew',
});