Orchestration SDKs

Configuring the DaVinci module

PingOne JavaScript

Configure DaVinci module for JavaScript properties to connect to PingOne and step through an associated DaVinci flow.

There are two methods for configuring the DaVinci module:

Full configuration

Use the JavaScript factory function to access all available settings, including JavaScript-specific options such as request middleware and custom loggers.

Common JSON configuration

Use a shared key-value structure that works identically across Android, iOS, and JavaScript, letting you load a single config file across platforms.

Full configuration

The following shows a full DaVinci module configuration:

Configure DaVinci module connection properties
import { davinci } from '@forgerock/davinci-client';

const davinciClient = await davinci({
  logger: {
    level: 'warn',
    custom: customLogger,
  },
  config: {
    clientId: '6c7eb89a-66e9-ab12-cd34-eeaf795650b2',
    redirectUri: 'https://localhost:8443/callback',
    serverConfig: {
      wellknown: 'https://auth.pingone.com/3072206d-c6ce-ch15-m0nd-f87e972c7cc3/as/.well-known/openid-configuration',
      timeout: 3000,
    },
    scope: 'openid profile email phone',
    responseType: 'code',
  },
});

Common JSON configuration

You can provide the same configuration as a JSON object, which lets you share a single config file across Android, iOS, and JavaScript.

Use the makeDavinciConfig() helper from @forgerock/sdk-utilities to convert the JSON to native config, then pass it to davinci():

Configure the DaVinci module from a JSON object
import { davinci } from '@forgerock/davinci-client';
import { makeDavinciConfig } from '@forgerock/sdk-utilities';

const unifiedConfig = {
    timeout: 30000, // milliseconds
    log: 'WARN',
    oidc: {
        clientId: '6c7eb89a-66e9-ab12-cd34-eeaf795650b2',
        discoveryEndpoint:
            'https://auth.pingone.com/3072206d-c6ce-ch15-m0nd-f87e972c7cc3/as/.well-known/openid-configuration',
        scopes: ['openid', 'profile', 'email', 'revoke'],
        redirectUri: 'https://localhost:8443/callback',
    },
};

const davinciClient = await davinci({
    config: makeDavinciConfig(unifiedConfig),
});

Because makeDavinciConfig() returns a standard native config object, you can combine it with JavaScript-specific options in the same davinci() call:

Combining JSON config with JavaScript-specific options
const davinciClient = await davinci({
    config: makeDavinciConfig(unifiedConfig),
    logger: { level: 'debug', custom: myCustomLogger },
    requestMiddleware: [customHeaderMiddleware],
});

The makeDavinciConfig() helper maps JSON properties to the native config automatically:

  • oidc.discoveryEndpointconfig.serverConfig.wellknown

  • oidc.scopes (array) → config.scope (space-separated string)

  • timeoutconfig.serverConfig.timeout

Optionally, you can store the JSON in a file alongside your app and load it at runtime so the same file can be shared across platforms.

Configuration property reference

The following properties are available when configuring the DaVinci module for JavaScript.

The JSON property column shows the equivalent key when using JSON configuration.

config{} Properties
Property JSON property Description Required?

serverConfig: {timeout}

timeout

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

For example, for 30 seconds specify 30000.

Defaults to 5000 (5 seconds).

When using JSON configuration, specify timeout at the root level.

No

serverConfig: {wellknown}

oidc.discoveryEndpoint

Your PingOne server’s .well-known/openid-configuration endpoint.

Example:

https://auth.pingone.com/3072206d-c6ce-ch15-m0nd-f87e972c7cc3/as/.well-known/openid-configuration

Yes

clientId

oidc.clientId

The client_id of the OAuth 2.0 client profile to use.

For example, 6c7eb89a-66e9-ab12-cd34-eeaf795650b2

Yes

redirectUri

oidc.redirectUri

The redirect_uri as configured in the OAuth 2.0 client profile.

This value must match a value configured in your OAuth 2.0 client.

For example, https://localhost:8443/callback.

Yes

scope

oidc.scopes

A list of scopes to request when performing an OAuth 2.0 authorization flow, separated by spaces.

For example, "openid", "email", "address", "profile", "phone".

When using JSON configuration, provide scopes as an array. The SDK joins the values into a space-separated string.

Yes

par

oidc.par

Whether to use Pushed Authorization Requests (PAR) for communicating with the authorization server.

No

responseType

The type of OAuth 2.0 flow to use, either code or token.

Defaults to code.

No

logger{} Properties
Property JSON property Description Required?

level

log

Specify what level of logging the Orchestration SDK should output.

Select one of the following:

  • none

  • error

  • warn

  • info (the default)

  • debug

In JSON configuration, set the log property at the root level, with values NONE, ERROR, WARN, INFO or DEBUG.

No

custom

Specify a custom logger the Orchestration SDK should use to output messages.

Example:

customLogger

No