This article describes how to configure a mobile app, based on Pega Mobile Client, to authenticate using OpenID connect protocol, with Pega Platform acting as an identity broker and Okta as identity provider.
While the general approach is described here, this how-to focuses on aspects specific to using Okta as identity provider and Open ID Connect as authentication protocol. It will take you through the steps needed to configure two authentications processes - one between Pega Mobile Client and Pega Platform, and one between Pega Platform and Okta.
The steps have been verified with:
Pega Platform 8.1.1
Pega Mobile Client 7.41.0
Access to Developer Console of your development Okta instance, which you can request at developer.okta.com
Access to Dev Studio of your Pega Platform instance
Mobile phone for verifying the setup
Part One, in which we configure Pega Platform to talk to Okta authentication server
Step 1: Define application in Okta
The first step is to configure Okta service for authenticating users via OpenID Connect protocol. In order to do so, login to the Okta Developer Console and create a new application, by clicking Applications > Add Application. Although at this point we are configuring integration between Pega Platform and Okta, the end-users will use a native mobile app, so you need to chose ”Native” as the application type.
Give the application a name (“Pega” in our example) and make sure that grant type is set to “Authorization code”. Leave the default redirect URI, we will change it later. Click "Done" to actually create the application.
Because Pega Platform requires the use of Client Secret, you have modify Client Credentials section of the integration and switch from “Use PKCE” to “Use Client Authentication”. Keep in mind that in case of this integration Client means Pega Platform, not the distributed native app, so using this option is OK. Switching to “Use Client Authentication” will give you access to Client Secret. Note it down, along with Client ID from the same section.
You need one more piece of information, which is the URL to your Okta authentication server. This is listed as “Org URL” on the dashboard of the Okta developer console. In our example it is "https://dev-500306.oktapreview.com"
Make a request for the corresponding URL for your server to make sure the metadata is available. The request should return a non-empty JSON file.
Step 2: Create Authentication Service in Pega Platform
In this step you will create the Pega side of the integration between Pega Platform and Okta. To do so, login to Dev Studio of your Pega instance and click Configure > Org & Security > Authentication > Create Authentication Service. Choose “OpenID Connect” as the type, fill in other fields and click “Create and open”
On the next screen give the service an alias (it’s "Okta" in our example) and click “Import metadata” to import the OpenID Connect configuration from the Okta URL you gathered in the previous step (it's the URL ending with ".well-known/openid-configuration"). This will fill-in the "OpenID Connect provider configuration" section.
Next configure Client Id and Client Secret based on what you noted in Okta Developer Console in the previous step.
Finally you need to specify the name of OAuth claim that will be used to map users authenticated in Okta to Pega operators. The claim name must be specified in curly braces. The list of valid OAuth claims is specified in OpenID Connect protocol specification, and is available here. As claims are tied to scopes, make sure the scope for the claim you want to use is listed in the "Scope" field.
Remember to save the authentication service. Additionally, ensure that any operator which is expected to authenticate against Okta has “Use external authentication” option enabled.
See here for more information about operator mapping, as this is not specific to Okta.
Step 3: Configure Redirection URL
The next step in configuring the authentication process between Pega Platform and Okta is to configure the URL, to which the end-user will be redirected after successful authentication in Okta. You can find this URL in the "Redirect URI" field of your authentication service. Copy the URL from this field, login to Okta Developer Console, and paste it in place of the default Login redirect URI in your application.
At this point you should have Redirect URI, Client ID and Client Secret set to the same values in Pega authentication service and in Okta application.
Step 4: Verify
It’s time to verify that it all works and Pega Platform can authenticate users against Okta. Make sure you have a user in Okta, which can be mapped to Pega operator in accordance with the mapping you defined in Step 2. With a web browser in incognito mode, go to the URL specified in your authentication service as Login URL. You should be redirected to the Okta login screen, and after authenticating redirected back to Pega Platform, successfully logged in.
Part Two, in which we configure mobile app to talk to Pega Platform
Step 5: Create client registration endpoint in Pega Platform
Log in to Dev Studio and create client registration endpoint to be used by Pega Mobile Client. Click Create > Security > OAuth 2.0 Client Registration, fill-in the fields and click “Create and Open”
On the next screen you need to note down Client Id and Client Secret generated for you by Pega Platform. Just click “View & Download” to have this information conveniently exported to a text file. Notice that in this case Client represents your native app, so obviously the Client ID is different from the Client ID you have in Okta integration, where Client represented Pega Platform.
Because we want to use OpenID Connect protocol, you need to make adjustments to registration endpoint configuration:
Choose authorization code as the only supported grant type
Add the Redirect URI. In later steps you will configure your native app to register as a handler for this URI, so the scheme should be unique to your native app
Enable refresh token
Enable PKCE, because this is recommended for distributed native apps, and in this configuration your client is a native app
Save your changes
Step 6: Build your mobile app
You should just follow the process described here, there is nothing specific to Okta. The custom.properties file corresponding to the example described in this how-to looks as follows: