For up-to-date product documentation, see the IBM MobileFirst Foundation Developer Center.
Set up MobileFirst security for the iPhone app and the watchOS 2 app
We can set up MobileFirst security for our iPhone app and watchOS 2 app by registering each as a separate target on the IBM MobileFirstâ„¢ Platform Server.
Before you begin
For this example, we must have already created:
- An Xcode project with the MobileFirst frameworks installed using both a main app and a watchkit extension, each registered separately on the MobileFirst Server. See Set up watchOS 2 development in Xcode.
- An adapter with a defined scope, and two security checks: one for username/password and one for a pin code. For more information on the configuring the security see Security checks.
.
The Apple Watch and iPhone devices differs physically. Therefore the security checks for each must be appropriate for the available input devices. For example, the Apple Watch is limited to a number pad and does not allow the usual username/password security check. Therefore access to protected resources on the server could be enabled using a pin code. Because of these and similar differences, it is necessary to apply different security checks for each target.
Below is one example of creating an app with both an iPhone and an Apple Watch target. This architecture allows each to have its own security check. The differing security checks are just examples of how we can design features for each target. Additional security checks might be available.
Procedure
- Determine the scope and security checks defined by the protected resource. See Security-checks configuration.
- In the IBM MobileFirst Platform Operations Console:
- Ensure that both apps are registered on the server:
- com.worklight.[project_name]
- com.worklight.[project_name].watchkitextension
- Map the scopeName to the defined security checks:
- For com.worklight.[project_name] map it to the username/password check.
- For com.worklight.[project_name].watchkitapp.watchkitextension map it to the pin code security check.
Results
The Xcode project now contains a main app and a watchOS 2 app, each with its own security check. For more results see the watchOS Tutorial.
Parent topic: Develop for watchOS 2