ForgeRock Developer Experience

Step 2. Configure the sample app

In this step, you configure the "FRExample" app to connect to the OAuth 2.0 application you created in PingFederate, using the centralized login method.

  1. In Xcode, on the File menu, click Open.

  2. Navigate to the forgerock-ios-sdk folder you cloned in the previous step, navigate to SampleApps > FrExample > FRExample.xcodeproj, and then click Open.

  3. In the Project Navigator pane, navigate to FRExample > FRExample, and open the ViewController file.

  4. In the ViewController file:

    1. Change the useDiscoveryURL variable to true:

      let useDiscoveryURL = true

      Changing the variable causes the sample to use the discover method to get many of the required configuration values from your PingFederate OIDC .well-known endpoint.

    2. Replace CLIENT_ID_PLACEHOLDER with the ID of the OAuth 2.0 client application you created previously in PingFederate:

      let config =
      ["forgerock_oauth_client_id": "sdkPublicClient",
      "forgerock_oauth_redirect_uri": "org.forgerock.demo://oauth2redirect",
      "forgerock_oauth_scope" : "openid profile email address",
      "forgerock_ssl_pinning_public_key_hashes": ["SSL_PINNING_HASH_PLACEHOLDER"]]
    3. Remove or comment out the forgerock_ssl_pinning_public_key_hashes line.

      For information on SSL pinning, refer to Enable SSL pinning.

    4. Replace DISCOVERY_URL_PLACEHOLDER with the .well-known endpoint from your PingFederate server.

      The .well-known endpoint is the base URL of your PingFederate server, with /.well-known/openid-configuration appended.

      How do I find my PingFederate Base URL?

      To verify 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.

      For example:

      let discoveryURL = "https://pingfed.example.com/as/.well-known/openid-configuration"

For more information, refer to Editing an application - OIDC.

With the sample configured, you can proceed to Step 3. Run the sample app and perform centralized login.

Copyright © 2010-2024 ForgeRock, all rights reserved.