---
title: Step 2. Configure connection properties
description: Prepare
component: sdks
version: latest
page_id: sdks:oidc:tutorials/ios/pingone/02_configuring-sample-for-pingone
canonical_url: https://docs.pingidentity.com/sdks/latest/oidc/tutorials/ios/pingone/02_configuring-sample-for-pingone.html
revdate: Thu, 24 Apr 2025 14:44:20 +0100
keywords: ["OAuth 2.0", "OpenID Connect", "Tutorial", "Source Code", "Integration", "SDK", "iOS"]
---

# Step 2. Configure connection properties

* [Prepare](00_before-you-begin.html)

* [Download](01_downloading-forgerocksdk.html)

* **Configure**

* [Run](03_running-sample-pingone.html)

***

In this step, you configure the "swiftui-oidc" app to connect to the OAuth 2.0 application you created in PingOne, and display the login UI of the server.

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

2. Navigate to the `sdk-sample-apps` folder you cloned in the previous step, navigate to `iOS` > `swiftui-oidc` > `PingExample` > `PingExample.xcodeproj`, and then click Open.

3. In the Project Navigator pane, navigate to **PingExample > PingExample > Utilities**, and open the `ConfigurationManager` file.

4. Locate the `ConfigurationViewModel` function which contains placeholder configuration properties.

   |   |                                                                                     |
   | - | ----------------------------------------------------------------------------------- |
   |   | The function is commented with `//TODO:` in the source to make it easier to locate. |

   ```swift
   return ConfigurationViewModel(
       clientId: "[CLIENT ID]",
       scopes: ["openid", "email", "address", "phone", "profile"],
       redirectUri: "[REDIRECT URI]",
       signOutUri: "[SIGN OUT URI]",
       discoveryEndpoint: "[DISCOVERY ENDPOINT URL]",
       environment: "[ENVIRONMENT - EITHER AIC OR PingOne]",
       cookieName: "[COOKIE NAME - OPTIONAL (Applicable for AIC only)]",
       browserSeletorType: .authSession
   )
   ```

5. In the `ConfigurationViewModel` function, update the following properties with the values you obtained when preparing your environment.

   * *clientId*

     The client ID from your OAuth 2.0 application in PingOne.

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

   * *scopes*

     The scopes you added to your OAuth 2.0 application in PingOne.

     For example, `openid profile email phone`

   * *redirectUri*

     The `redirect_uri` to return to after logging in with the server UI, for example the URI to your client app.

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

     For example, `org.forgerock.demo://oauth2redirect`.

   * *signOutUri*

     Leave this property empty.

     It signals that the SDK can use the ID token to end the user's session, and does not need to open and return from a web page to perform log out.

     |   |                                                                                                                                                          |
     | - | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
     |   | You must have enabled the **Terminate User Session by ID Token** setting when creating the OAuth 2.0 client in PingOne if you leave this property empty. |

   * *discoveryEndpoint*

     The `.well-known` endpoint from your PingOne tenant.

     > **Collapse: How do I find my PingOne .well-known URL?**
     >
     > To find the `.well-known` endpoint for an OAuth 2.0 client in PingOne:
     >
     > 1. Log in to your PingOne administration console.
     >
     > 2. Go to **Applications > Applications**, and then select your OAuth 2.0 client.
     >
     >    For example, sdkPublicClient.
     >
     > 3. On the **Overview** tab, expand the **Connection Details** section, and then copy the **OIDC Discovery Endpoint** value.
     >
     >    ![Locating the .well-known URL in a PingOne client profile.](../../../../_images/p1-client-well-known.png)

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

   * *environment*

     Ensures the sample app uses the correct behavior for the different servers it supports, for example what logout parameters to use.

     For PingOne and PingAM servers, specify `AIC`.

   * *cookieName*

     Set this property to an empty string.

     For example, `""`.

   * *\*browserSeletorType\**

     You can specify what type of browser the client iOS device opens to handle centralized login.

     Each browser has slightly different characteristics, which make them suitable to different scenarios, as outlined in this table:

     | Browser type            | Characteristics                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
     | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
     | `.authSession`          | Opens a [web authentication session](https://developer.apple.com/documentation/authenticationservices/aswebauthenticationsession) browser.Designed specifically for authentication sessions, however it prompts the user before opening the browser with a modal that asks them to confirm the domain is allowed to authenticate them.This is the default option in the Ping (ForgeRock) SDK for iOS.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
     | `.ephemeralAuthSession` | Opens a [web authentication session](https://developer.apple.com/documentation/authenticationservices/aswebauthenticationsession) browser, but enables the [`prefersEphemeralWebBrowserSession`](https://developer.apple.com/documentation/authenticationservices/aswebauthenticationsession/prefersephemeralwebbrowsersession) parameter.This browser type *does not* prompt the user before opening the browser with a modal.The difference between this and `.authSession` is that the browser does not include any existing data such as cookies in the request, and also discards any data obtained during the browser session, including any session tokens.When is `ephemeralAuthSession` suitable:- [icon: times, set=fa]`ephemeralAuthSession` is *not* suitable when you require single sign-on (SSO) between your iOS apps, as the browser will not maintain session tokens.

     - [icon: times, set=fa]`ephemeralAuthSession` is *not* suitable when you require a session token to log a user out of the server, for example for logging out of PingOne, as the browser will not maintain session tokens.

     - [icon: check, set=fa]Use `ephemeralAuthSession` when you do not want the user's existing sessions to affect the authentication. |
     | `.nativeBrowserApp`     | Opens the installed browser that is marked as the default by the user. Often Safari.The browser opens without any interaction from the user. However, the browser does display a modal when returning to your application.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
     | `.sfViewController`     | Opens a [Safari view controller](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller) browser.Your client app is ***not*** able to interact with the pages in the `sfViewController` or access the data or browsing history.The view controller opens within your app without any interaction from the user. As the user does not leave your app, the view controller does not need to display a warning modal when authentication is complete and control returns to your application.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |

   The result resembles the following:

   ```swift
   return ConfigurationViewModel(
       clientId: "6c7eb89a-66e9-ab12-cd34-eeaf795650b2",
       scopes: ["openid", "email", "phone", "profile"],
       redirectUri: "org.forgerock.demo://oauth2redirect",
       signOutUri: "",
       discoveryEndpoint: "https://auth.pingone.com/3072206d-c6ce-ch15-m0nd-f87e972c7cc3/as/.well-known/openid-configuration",
       environment: "AIC",
       cookieName: "",
       browserSeletorType: .authSession
   )
   ```

6. Optionally, specify ACR values to choose which authentication journey the server uses.

   1. Navigate to **PingExample > PingExample > ViewModels**, and open the `OIDCViewModel` file.

   2. In the `startOIDC()` function, add an `acr_values` parameter to the authorization request by using the `setCustomParam()` method:

      ```swift
      public func startOIDC() async throws → FRUser {
          return try await withCheckedThrowingContinuation({
              (continuation: CheckedContinuation<FRUser, Error>) in
              Task { @MainActor in
                  FRUser.browser()?
                      .set(presentingViewController: self.topViewController!)
                      .set(browserType: ConfigurationManager.shared.currentConfigurationViewModel?.getBrowserType() ?? .authSession)
                      .setCustomParam(key: "acr_values", value: "sdkUsernamePasswordJourney")
                      .build().login { (user, error) in
                          if let frUser = user {
                              Task { @MainActor in
                                  self.status = "User is authenticated"
                              }
                              continuation.resume(returning: frUser)
                          } else {
                              Task { @MainActor in
                                  self.status = error?.localizedDescription ?? "Error was nil"
                              }
                              continuation.resume(throwing: error!)
                          }
                      }
              }
          })
      }
      ```

      Enter one or more of the ACR mapping keys as configured in the OAuth 2.0 provider service.

      To learn more, refer to [Choose journeys with ACR values](../../../sdkconfiguration/add-acr-values.html).

      |   |                                                                                                                                                              |
      | - | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
      |   | You can list the available keys by inspecting the `acr_values_supported` property in the output of your `/oauth2/.well-known/openid-configuration` endpoint. |
