Ping SDKs

Step 3. Configure connection properties

In this step, you configure the sample app to connect to the OAuth 2.0 application you created in PingFederate.

  1. In the IDE of your choice, open the sdk-sample-apps folder you cloned in the previous step.

  2. Open the /central-login/src/main.js file.

  3. Replace the forgerock.Config.set method with this code:

    await Config.setAsync({
      clientId: "<PingFederate Client ID>",
      redirectUri: `${window.location.origin}`,
      scope: "address email openid phone profile",
      serverConfig: {
        wellknown: "<PingFederate .well-known URL>",
      },
    });

    Replace the following strings with the values you obtained when you registered an OAuth 2.0 application in PingFederate.

    <PingFederate Client ID>

    The client ID from your OAuth 2.0 application in PingFederate.

    For example, sdkPublicClient

    <PingFederate .well-known URL>

    The .well-known endpoint of your PingFederate server.

    How do I find my PingFederate .well-known URL?

    You can form your .well-known endpoint by adding /.well-known/openid-configuration to your server’s base URL.

    To view the base URL of your PingFederate server:

    1. Log in to your PingFederate administration console.

    2. Navigate to System  Server  Protocol Settings.

    3. Make a note of the Base URL value.

      Do not use the admin console URL.
    4. Append `/.well-known/openid-configuration ` to your base URL.

    For example, https://pingfed.example.com/.well-known/openid-configuration

    The result resembles the following:

    await Config.setAsync({
      clientId: "sdkPublicClient",
      redirectUri: `${window.location.origin}`,
      scope: "address email openid phone profile",
      serverConfig: {
        wellknown: "https://pingfed.example.com/.well-known/openid-configuration",
      },
    });