Provides an example login iOS application for use with PingOne for Customers. This sample application is written in Swift
Sample config
{
"environment_id": "{env_id}",
"client_id": "{client_id}",
"redirect_uri": "{redirect_schema}",
"authorization_scope": "{auth_scopes}",
"discovery_uri": "https://auth.pingone.com/%s/as/.well-known/openid-configuration",
"token_method": "{CLIENT_SECRET_POST || CLIENT_SECRET_BASIC || NONE}",
"client_secret": "{client_secret}"
}
where
environment_id
: Required. Your application's Environment ID. You can find this value at your Application's Settings under Configuration tab from the admin console( extractxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
string that specifies the environment 128-bit universally unique identifier (UUID) right fromhttps://auth.pingone .com/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/as/authorize
AUTHORIZATION URL ). Or from the Settings main menu (ENVIRONMENT ID variable)client_id
: Required. Your application's client UUID. You can also find this value at Application's Settings right under the Application name.redirect_uri
: Required. The URL to which the PingOne will redirect the user's browser after authorization has been granted by the user. REDIRECT URLS values corresponds to this data. The Access and ID Token will be available in the hash fragment of this URL.authorization_scope
: standard OIDC or PingOne custom scopes, separated by a space which you want to request authorization for. PingOne platform scopes are configured under "Access" tab in PingOne Admin Consolediscovery_uri
: Required. The URL describe App configuration with allowed methods, system URL's, etctoken method
: Required. The login method what is enabled in Applicatin configuration, possible variants - CLIENT_SECRET_POST || CLIENT_SECRET_BASIC || NONEclient_secret
: Required. Your application's client secret. You can also find this value at Application's Settings page
You will need your own PingOne for Customers tenant. You can sign up for a trial.
- PingOne for Customers Account - If you don’t have an existing one, please register it.
- An OpenID Connect Application, configured in Native App mode. Also make sure that it is enabled plus redirect URL's and access grants by scopes are properly set.
- At least one user in the same environment as the application (not assigned)
- Update auth_config.json with your tenant's variables
Once you have your own tenant, use the PingOne for Customers Admin Console to add an application connection. To create the application connection:
- Click Connections.
- Click + Application.
- Select the Single Page App type.
- Click Configure.
- Create the application profile by entering the following information:
- Application name: OIDC Authentication iOS or other name
- Click Next.
- Redirect URI: The URL where dist/login/ will live. For example, https://www.example.com/login/
- Click Save and Continue
- At a minimum, add the following scope: profile
- Click Save and Close
The Applications page shows the new application. Click the toggle switch to enable the application. View the details of your application and make note of its Client ID.
- Edit the Application (click the pencil icon)
- On the Profile Tab of your new application, populate SignOn URL with the location that dist/login/ will live. For example, https://www.example.com/login/
- On the Configuration Yab of your new application, populat SignOff URLs with the location that dist/logout/ will live. For example, https://www.example.com/logout/
- Click Save
To get your Environment ID, in the Admin Console, click Settings, then Environment, then Properties. The Properties page shows the environment ID.
To create your test user:
- Click Users.
- Click + Add User.
- At a minimum, specify a username such as michael@example.com.
- Click Save
- View your new user and select Reset Password
- Specify an initial password, such as 4Science.
- Click Save
gil clone git@github.com:pingidentity/pingone-customers-sample-oidc-ios.git
Edit auth config with your tenant's variables (clientId, environmentId, others)
- Run
pod update
in cloned repo - Open workspace with XCode -
open PingOneiOS.xcworkspace
- Run APP, shortcut -
Cmd+R