Ping SDKs

Step 3. Configure connection properties


In this step, you configure the sample app to connect to the authentication tree/journey you created when setting up your server configuration.

  1. Choose how you want to configure the sample app. You can either configure the sample by using dynamic configuration, or by create a .env file.

    1. Open the /sdk-sample-apps/javascript/embedded-login/src/main.js file.

    2. Update the call to Config.setAsync() with the following code:

      await Config.setAsync({
        serverConfig: {
          wellknown: '{WELL_KNOWN}'
        },
        clientId: '{WEB_OAUTH_CLIENT}',
        tree: '{TREE}',
        scope: '{SCOPE}',
        redirectUri: `${window.location.origin}/callback.html`
      });
      javascript
    3. Replace the placeholder strings with the values you obtained when preparing your environment.

      {WELL_KNOWN}

      The .well-known endpoint of your server.

      PingOne Advanced Identity Cloud example:

      /oauth2/realms/root/realms/alpha/.well-known/openid-configuration

      How do I find my PingOne Advanced Identity Cloud .well-known URL?

      You can view the .well-known endpoint for an OAuth 2.0 client in the PingOne Advanced Identity Cloud admin console:

      1. Log in to your PingOne Advanced Identity Cloud administration console.

      2. Click Applications, and then select the OAuth 2.0 client you created earlier. For example, .

      3. On the Sign On tab, in the Client Credentials section, copy the Discovery URI value.

      PingAM example:

      /oauth2/realms/root/.well-known/openid-configuration

      {WEB_OAUTH_CLIENT}

      The client ID from your OAuth 2.0 application.

      For example,

      {TREE}

      The simple login journey or tree you created earlier.

      For example .

      {SCOPE}

      The scopes you added to your OAuth 2.0 application.

      For example, address email openid phone profile

      The result resembles the following:

      main.js
      await Config.setAsync({
        serverConfig: {
          wellknown: '/oauth2/realms/root/realms/alpha/.well-known/openid-configuration'
        },
        clientId: '',
        tree: '',
        scope: '',
        redirectUri: \`${window.location.origin}/callback.html`
      });
      javascript