Mobile App Services Foundation for Mobile App Development

by March 5, 2018

Welcome to CA Mobile App Services (MAS) blogs. MAS aims at saving your development time by providing complex mobile features wrapped in simple to use methods. Sounds interesting! So, stay with us for the exciting journey of using our MAS services for your Cordova-based apps. This blog post will walk you through the cool features of MAS, and will guide you to create a basic beginner app.

Let’s consider a coffee house as analogy to explain MAS. To enter the coffee house, you need proper credentials to get in and access the services. Once you are in the coffee house, you see a bustling place with people occupying tables. Consider the tables as groups and the people as the users.

The group administrator directs you to a table. You can create your own groups (if you’re that lonely). The server can let you access or deny access to certain services depending on your credentials. You can send messages to individuals or groups. You can also store your coffee, and retrieve it later. In the context of MAS, this situation represents the following four major components of MAS:

MAS Foundation

Authenticates users, manages users, apps, and device registration. Sounds difficult? Trust us, it is quite simple with our MAS Foundation module.

Identity Management

Manages identity of the users, creates and manages ad-hoc groups. Implements SCIM 2.0 standards to simplify user management.


Secures communication among groups is achieved by our robust MAS Connecta APIs.


Provides local and cloud storage facility with enterprise-grade encryption.

Now that you know the benefits of our wares, let us start building a basic Cordova app using the MAS Foundation to login and access a protected API.

What do you need to start?

  • A PC or MAC
  • Mobile device or a simulator
  • Xcode or Android Studio or a terminal
  • Mobile API Gateway (MAG)
    MAG shares the msso_config.json file that provides the address of the MAG server to the Cordova app.
  • Ionic

Follow the instructions to create a basic Cordova app to start a project:

1.       Run the following command in the terminal:

You just created a folder named masFoundation, where you have an app with a default template ready for you.

2.       Add iOS or Android mobile platform as follows:

Ensure that you have the Android Studio or an iOS xcodeproj ready in the platform folder.


3.       Now, add our esteemed plugin to the mix. Download or clone the MAS Foundation from GitHub repository.

4.       To add the plugin to your cordova project, run the following command:

where “PATH_TO_PLUGIN” is the location of the plugin on your machine.

Now let us dive down to the platform specific setup.  Let us view the iOS setup first. The Android setup section will be below.


1.     Download the SDK libraries from the CAAPIM Releases repository.
2.     Navigate to the “MAS-*latestVersion*-CR1/iOS” folder, and download the iOS-MobileSDK-<version>.zip file.
3.     Open the Cordova iOS project in Xcode, and add the MASFoundation.framework, MASUI.framework, and MASUIResources.bundle files.
4.     Configure the following property in the “.plist” file located in the Resources folder of the project:

A screenshot for your reference:

5.       In the capabilities section of the Target, enable the keychain sharing and add a singleSignOn keychain group options:

6.       Now, add the msso_config.json file to your project. Place this file anywhere inside the Xcodeproject, preferably in the Resources folder.


1.     Download the SDK libraries from the CAAPIM Releases repository.
2.     Navigate to the “MAS-*latestVersion*-CR1/Android” folder, and download the Android-MobileSDK-<version>.zip file.
3.     Open the ionic Android project in Android Studio and add the libraries to the libs directory of your project.

4.    Open the Cordova project in Android Studio, and add the MAS, Bouncycastle, and QRCode authentication dependencies in the build.gradle file.

5. Navigate to the module that contains the MAS integration in the build.gradle file, add the repository section that contains the libs path:


6.     Add a valid “msso_config.json” of your gateway into the assets folder of your project.

7. Update the minSdkVersion in AndroidManifest.xml file to 19 or more if the Android Studio recommends the current version of the Android SDK.

8. Update the target to android-23 or latest as required.

Congratulations!! You created your app. Now, the coding starts. Wait.. we have a sample app ready for you. Download the sample app and follow the instructions:

1.     Copy the www folder from the project to your www folder.
The SDK needs to set login and OTP authentication callbacks before an API request. The callbacks are invoked if the requested API requires user login, or the API is OTP protected. The initialization does this job.

The initialization method is as follows:

2.     Set the grant flow to password.

3.     Lastly, call the start method as follows:

We have successfully started the SDK now. Woohoo!!! Everything else from now on is just a method call away.

4.     Do you want to login? Call the following method:

Alternatively, you can summon our inbuilt login screen by calling any API. The API requires a user to log in. In our sample app, we handle the login internally, so you don’t have to do anything.

A lot of other features that MAS Foundation provides are documented at our MAS Official Documentation.