Show TOC

Adding the Logon PluginLocate this document in the navigation structure

To install the Logon plugin, use the Cordova command line interface.


  • Set up the development environment.
  • Create your Cordova project.
  • Add your OS platforms.


  1. Add the plugin, by entering, at the command prompt:

    cordova plugin add

  2. (Optional) To see a list of installed plugins in your Cordova project, open a command prompt or terminal window, navigate to your Cordova project folder, and enter:
    cordova plugins
    The Cordova command line interface returns a JSON array showing installed plugins, for example:
    [ '',    
    'org.apache.cordova.inappbrowser' ] 

    In this case, some core Cordova plugins were added, including corelibs, console, device, device-orientation, dialogs, and inAppBrowser. CoreLibs is a utility plugin that is automatically added to every Kapsel project by the command line interface, so you need never add the CoreLibs plugin to a project manually.

  3. Configure the application in the cockpit.
  4. Define a variable in the JavaScript code (typically, this is done in the index.html file of your Cordova application) to describe the app ID, for example:
    var appId = "";
    Kapsel uses an app ID to tell the server which application definition on the server to use for this application. The app ID that is defined on the server must match what is entered here.
  5. For Windows Phone, add the following code in index.html to provide the required WinJS references:
    <script src="//Microsoft.Phone.WinJS.2.1/js/base.js"></script>
    <script src="//Microsoft.Phone.WinJS.2.1/js/ui.js"></script>
  6. Define the connection to the server, for example:
    var defaultContext = {    
         "serverHost" : "",    
         "https" : "false",    
         "serverPort" : "8080",  
    This prepopulates the fields in the registration dialog that is shown to users during the initialization process.
  7. Make a call to the Logon plugin’s init method as shown:
    //Make call to Logon's Init method to get things registered and all set up  
    sap.Logon.init(logonSuccess, logonError, appId, defaultContext); 
    The init method gathers information about the environment’s security configuration by asking the Afaria client and Client Hub application, if available, sets up and configures the DataVault, connects to the server to register the application connection and authenticate the user. As part of this process, the appropriate screens are shown to gather user input and manage the entire process.
  8. Verify the registration in the cockpit.
    1. Log in to the cockpit.
    2. Click Applications.
    3. Click Registrations.
      You can see the registration ID following a successful registration.

  9. For Windows 8.1 or Windows Phone 8.1, add dependencies for the Logon plugin and all dependent plugins to your project in Visual Studio:
    • SAP.AuthProxy
    • SAP.InAppBrowser
    • SAP.Logon
    • SAP.LogonCore
    • SAP.Net.Http
    • SAP.SecureStore
    • SAP.Utils
  10. Use the Android IDE, Xcode, or Visual Studio to deploy and run the project.
    Note If you are deploying to an iOS device, in Xcode, you must add the clienthubEntitlements and $(CFBundleIdentifier) to the keychain group in the Entitlements section as well as the bundle identifier.