ForgeRock SDKs

Configure your JavaScript app

This section covers how to configure the settings the ForgeRock JavaScript SDK uses within your application.

Configuration strings

You provide the configuration strings by editing the serverConfig object, a parameter of the forgerock.Config.set() function.

Property Description


An interface for configuring how the SDK contacts the AM instance. Contains baseUrl and timeout.

serverConfig {baseUrl}

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

serverConfig {timeout}

An optional timeout, in milliseconds, for each request that communicates with AM. For example, for 30 seconds specify 30000. Defaults to 5000 (5 seconds).


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


The name of the tree to use.


The client_id of the OAuth 2.0 client profile to use.


The redirect_uri as set in the OAuth 2.0 client profile.


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


A threshold, in seconds, to refresh an OAuth 2.0 token before the access_token expires (defaults to 30 seconds).


The API to use for storing tokens on the client:


Store tokens using the sessionStorage API. The browser clears session storage when a page session ends.


Store tokens using the localStorage API. The browser saves local storage data across browser sessions. This is the default setting, as it provides the highest browser compatibility.


Store tokens using the indexedDB API. Storage of data using the indexedDB API depends on the browser used but is commonly persistent across browser sessions.

You cannot perform write operations using the IndexedDB API when Firefox is in private window mode. Use one of the other token storage APIs to support this mode.
Copyright © 2010-2023 ForgeRock, all rights reserved.