Overview
You will learn
- How to define your Mobile Services app to support certificate authentication
- How to configure the MDK client
- How to build a branded client
Prerequisites
Prerequisites
- Tutorial: Access SAP Mobile Services
- Download the latest version of mobile development kit SDK either from the SAP community trial download or SAP Software Center if you are a SAP Mobile Services customer
Steps
Make sure that you have completed required prerequisites mentioned in this tutorial.
Navigate to SAP Mobile Services admin UI.
On the home screen, click Create New App or navigate to Mobile Applications → Native/MDK → New.

Mobile Services Create New App Button In the Type of Application step, select the Mobile Development Kit (MDK) and choose Next.

Type Of Application Step MDK Selection In the Basic Info step, provide the required information and choose Next.
Field Value IDmyapp.mdk.certs NameSAP MDK cert auth App 
Basic Info Step Application Details Other fields are optional. For more information about these fields, see Creating Applications in the SAP documentation.
In the Security Settings step, continue with the default settings and choose Next.

Security Settings Step Default Configuration In the Role Settings step, continue with the default settings and choose Next.

Role Settings Step Default Configuration In the Assign Features step, continue with the default settings and choose Next.

Assign Features Step Default Settings In the Review step, you can verify the details of the application definition that you are creating. Make sure all the details are correct. Choose Edit to make any necessary modifications to the section. Choose Finish to create the mobile application configuration.

Application Review Step Finish Button If you see a Application is without Role Settings warning message, choose OK. You may assign roles after the app has been configured, if needed.
Once you have created your application, you see a list of default features have been automatically assigned to the app.

Default Features Assigned To App You can find more information on available features in SAP Mobile Services in help documentation.
When you configure an MDK app in Mobile Service admin UI, OAuth security is assigned to the app by default.
To enable certificate based authentication, you need to modify Redirect URL in Security configuration.
Click the Security tile.

Security Tile In App Configuration Click pencil icon to make changes to default configuration.

Edit Security Configuration Pencil Icon Replace the Redirect URL with
mdkcertclient://oauth2redirectparameter, and click OK to save the changes. This Redirect URL needs to be added in theAllowedDomainsproperty while building your branded client (step 3.5).
Redirect URL Updated To Certificate Client mdkcertclientis an URL scheme for your branded MDK client, you will use this value in step 3.3.oauth2redirectis just a random path. It could be any value.
To build your client,
- you can either use Cloud Build service option to build a standard MDK client by selecting Allow Certificate option or upload the
mdkprojectto build a customized MDK client. - OR build your branded client locally using MDK SDK as mentioned in below steps.
Make sure you are choosing the right development platform tab above.
Make sure that you have already completed steps 1 & 2 from Build Your Mobile Development Kit Client Using MDK SDK tutorial.
Make sure you are choosing the right development platform tab above.
This name of this folder is based on the
<App Name>provided in theMDKProject.json fileand this is the MDK client application generated project.
Make sure you are choosing the right device platform tab above.
In this step, you will Run the Project on an android device. First attach your device to your machine. Then run
tns device androidcommand to print a list of attached devices.
Android Device List In Terminal Make sure Developer option and USB debugging option is enabled in android device.
Copy the Device Identifier value for your device.
In terminal or command line window, navigate to the app name folder
MDKCertApp(inMDClient_SDKpath) and usetns run android --device <device identifier>command to run the MDK client on android device.
Run Android MDK Client Terminal Command Once, above command gets successfully executed, you will see new MDK client up and running in Android device.
Tap Agree on
End User License Agreement.
End User License Agreement Screen In Welcome screen, you will notice that app name, detailed label text and signing button text have been updated as per changes done in step 3.4 & 3.6. Tap Start to connect the MDK client to SAP Business Technology Platform (BTP).

Welcome Screen With Start Button As you enabled the certificate based authentication, MDK client detects a valid certificate installed on the device and connects successfully to the SAP BTP.

Certificate Authentication Connection Success If the user certificate is not valid or not detectable, then you will see an SAP BTP login page.
Choose a passcode with at least 8 characters for unlocking the app and tap Next.

Passcode Entry Screen Android Confirm the passcode and tap Done.

Passcode Confirmation Screen Android If you want your MDK client to send you notification, click Next.

Push Notification Permission Screen Optionally, you can enable biometric authentication to get faster access to the app data.

Since no metadata has been deployed yet, you will see a message box suggesting next steps.

In this step, In this step, you will Run the Project on an iOS device. First attach the device to your Mac. Then run
tns device ioscommand to print a list of attached devices.
iOS Device List In Terminal Copy the Device Identifier value for your device.
In terminal window, navigate to the app name folder
MDKCertApp(inMDClient_SDKpath) and usetns run ios --device <device identifier>command to run the MDK client on iOS device.
Run iOS MDK Client Terminal Command You can also Run the Project in Xcode. Open the project in Xcode with the command
open platforms/ios/<app name>.xcworkspace, or open the workspace using theFile -> Open...dialog in Xcode. Configure the application’s code signing settings, then Run the project for the target device.Once, above command gets successfully executed, you will see new MDK client up and running in your device.
Tap Agree on
End User License Agreement.
iOS End User License Agreement Screen In Welcome screen, you will notice that app name, detailed label text and signing button text have been updated as per changes done in step 3.4 & 3.6.

iOS Welcome Screen Updated App Name Tap Start to connect the MDK client to SAP Business Technology Platform (BTP). As you enabled the certificate based authentication, MDK client detects a valid certificate installed on the device and connects successfully to the SAP BTP.

iOS Certificate Authentication Connecting 
iOS Certificate Authentication Success If the user certificate is not valid or not detectable, then you will see an SAP BTP login page.
Choose a passcode with at least 8 characters for unlocking the app and tap Next.

iOS Passcode Entry Screen Confirm the passcode and tap Done.

iOS Passcode Confirmation Screen Optionally, you can enable biometric authentication to get faster access to the app data, tap Enable.

iOS Biometric Authentication Enable Screen Since no metadata has been deployed yet, you will see a message box suggesting next steps.

iOS No Metadata Deployed Message Box
Resources
Discussion
Share feedback on this tutorial or join the conversation in SAP Community.

















