Step 3. Test the app
In the following procedure, you run the sample app that you configured in the previous step. The app steps through the login journey, rendering a UI to collect the required data for each node, for example a username and password node, together inside a page node.
-
In Xcode, select Product > Run.
Xcode launches the sample app in the iPhone simulator.
Figure 1. Starting the quickstart app in an iOS simulator -
In the sample app on the iPhone simulator, tap the Login button.
The app displays fields to input the user’s credentials:
Figure 2. Login as your demo user -
Sign on using the credentials of your demo user, and then click Next. For example:
-
User Name:
demo
-
Password:
Ch4ng3it!
If authentication is successful the app displays a message that the user is authenticated and enables the Logout button:
Figure 3. Login as your demo userThe console in Xcode outputs the access token, as well as a message that the user is authenticated:
[FRCore][4.6.0] [🌐 - Network] Response | [✅ 200] : https://openam-forgerock-sdks.forgeblocks.com/am/oauth2/realms/alpha/access_token in 77 ms Response Header: [ AnyHashable("x-forgerock-transactionid"): 670c-c3e9, AnyHashable("Content-Type"): application/json;charset=UTF-8, AnyHashable("Date"): Tue, 12 Nov 2024 15:36:27 GMT, Response Data: { "access_token":"eyJ0…Pc8k", "refresh_token":"eyJ0…dnA4", "scope":"address openid profile email", "id_token":"eyJ0…czKQ", "token_type":"Bearer", "expires_in":3598 } ] User is authenticated
-
-
Tap Logout to revoke the tokens, end the session, and return to the initial screen.
The console in Xcode outputs the calls to the
/sessions
and/revoke
endpoints:Logout button is pressed [FRCore][4.6.0] [🌐 - Network] Request | [POST] https://openam-forgerock-sdks.forgeblocks.com/am/json/realms/alpha/sessions Additional Headers: [ "accept-api-version": "resource=3.1", "8a92ca506c38f08": "qc7z…MQ.."] URL Parameters: ["_action": "logout"] Body Parameters: ["tokenId": "qc7z…MQ.."] [FRCore][4.6.0] [🌐 - Network] Request | [POST] https://openam-forgerock-sdks.forgeblocks.com/am/oauth2/realms/alpha/token/revoke Body Parameters: [ "token": "eyJ0…dnA4", "client_id": "sdkPublicClient"] [FRCore][4.6.0] [🌐 - Network] Response | [✅ 200] : https://openam-forgerock-sdks.forgeblocks.com/am/json/realms/alpha/sessions?_action=logout in 117 ms Response Data: { "result":"Successfully logged out"} [FRCore][4.6.0] [🌐 - Network] Response | [✅ 200] : https://openam-forgerock-sdks.forgeblocks.com/am/oauth2/realms/alpha/token/revoke in 113 ms Response Data: {}