---
title: Step 2. Configure connection properties
description: Prepare
component: sdks
version: latest
page_id: sdks:oidc:tutorials/ios/pingfed/02_configuring-sample-for-pingfed
canonical_url: https://docs.pingidentity.com/sdks/latest/oidc/tutorials/ios/pingfed/02_configuring-sample-for-pingfed.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-pingfed.html)

***

In this step, you configure the "swiftui-oidc" app to connect to the OAuth 2.0 application you created in PingFederate, 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 PingFederate.

     For example, `sdkPublicClient`

   * *scopes*

     The scopes you want to assign in PingFederate.

     For example, `openid profile email phone`

   * *redirectUri*

     The **Redirect URIs** as configured in the OAuth 2.0 client profile.

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

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

   * *signOutUri*

     The **Front-Channel Logout URIs** as configured in the OAuth 2.0 client profile.

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

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

   * *discoveryEndpoint*

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

     > **Collapse: How do I form my PingFederate .well-known URL?**
     >
     > To form the `.well-known` endpoint for a PingFederate server:
     >
     > 1. Log in to your PingFederate administration console.
     >
     > 2. Navigate to **System** [icon: angle-right, set=fa] **Server** [icon: angle-right, set=fa] **Protocol Settings**.
     >
     > 3. Make a note of the **Base URL** value.
     >
     >    For example, `https://pingfed.example.com`
     >
     >    |   |                                   |
     >    | - | --------------------------------- |
     >    |   | Do not use the admin console URL. |
     >
     > 4. Append `/.well-known/openid-configuration` after the base URL value to form the `.well-known` endpoint of your server.
     >
     >    For example, `https://pingfed.example.com/.well-known/openid-configuration`.
     >
     >    The SDK reads the OAuth 2.0 paths it requires from this endpoint.

     For example, `https://pingfed.example.com/.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 PingFederate specify `PingOne`.

   * *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: "sdkPublicClient",
       scopes: ["openid", "email", "phone", "profile"],
       redirectUri: "org.forgerock.demo://oauth2redirect",
       signOutUri: "org.forgerock.demo://oauth2redirect",
       discoveryEndpoint: "https://pingfed.example.com/.well-known/openid-configuration",
       environment: "PingOne",
       cookieName: "",
       browserSeletorType: .authSession
   )
   ```

With the sample configured, you can proceed to [Step 3. Test the app](03_running-sample-pingfed.html).
