Step 2. Configure the sample app
In this step, you configure the "uikit-quickstart" sample app to connect to the OAuth 2.0 application you created in PingOne Advanced Identity Cloud or PingAM, using the embedded login method.
-
In Xcode, on the File menu, click Open.
-
Navigate to the
sdk-sample-apps
folder you cloned in the previous step, navigate toiOS
>uikit-quickstart
>Quickstart.xcodeproj
, and then click Open. -
In the navigator pane in Xcode, right-click
FRAuthConfig
and select Open As > Source Code. -
Replace the existing file content with the following:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>forgerock_url</key> <string>{as_url}</string> <key>forgerock_cookie_name</key> <string>{cookie_name}</string> <key>forgerock_realm</key> <string>{realm_path}</string> <key>forgerock_oauth_client_id</key> <string>{oauth2_client_id}</string> <key>forgerock_oauth_redirect_uri</key> <string>{oauth2_redirect}</string> <key>forgerock_oauth_scope</key> <string>openid profile email address</string> <key>forgerock_oauth_threshold</key> <string>60</string> <key>forgerock_timeout</key> <string>60</string> <key>forgerock_auth_service_name</key> <string>sdkUsernamePasswordJourney</string> <key>forgerock_registration_service_name</key> <string>Registration</string> </dict> </plist>
-
Replace the following strings with the values you obtained when you registered the OAuth 2.0 application in either PingOne Advanced Identity Cloud or PingAM:
- {as_url}
-
The base URL of the server to connect to.
Identity Cloud example:
https://openam-forgerock-sdks.forgeblocks.com/am
Self-hosted example:
https://openam.example.com:8443/openam
- {cookie_name}
-
The name of the cookie that contains the session token.
For example, with a self-hosted PingAM server this value might be
iPlanetDirectoryPro
.PingOne Advanced Identity Cloud tenants use a random alpha-numeric string.
To locate the cookie name in an PingOne Advanced Identity Cloud tenant, navigate to Tenant settings > Global Settings, and copy the value of the Cookie property.
- {realm_path}
-
The realm in which the OAuth 2.0 client profile and authentication journeys are configured.
Usually,
root
for AM andalpha
orbeta
for Advanced Identity Cloud. - {oauth2_client_id}
-
The client ID of your OAuth 2.0 application in PingOne Advanced Identity Cloud or PingAM.
For example,
sdkPublicClient
- {oauth2_redirect}
-
The
redirect_uri
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
.
The result resembles the following:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>forgerock_url</key> <string>https://openam.example.com:8443/openam</string> <key>forgerock_cookie_name</key> <string>iPlanetDirectoryPro</string> <key>forgerock_realm</key> <string>alpha</string> <key>forgerock_oauth_client_id</key> <string>sdkPublicClient</string> <key>forgerock_oauth_redirect_uri</key> <string>org.forgerock.demo://oauth2redirect</string> <key>forgerock_oauth_scope</key> <string>openid profile email address</string> <key>forgerock_oauth_threshold</key> <string>60</string> <key>forgerock_timeout</key> <string>60</string> <key>forgerock_auth_service_name</key> <string>sdkUsernamePasswordJourney</string> <key>forgerock_registration_service_name</key> <string>Registration</string> </dict> </plist>
-
Save your changes.
With the sample configured, you can proceed to Step 3. Run the sample app and perform embedded login.