Overview

The SAP Cloud Platform UserAPI provides a service which can be used to access details of the logged in user.  The details of this service can be found at

https://help.hana.ondemand.com/help/frameset.htm?1de599bf722446849d2b2e10132df42a.html

This service is available to html5 applications running on the Cloud Platform.  For an example of utilizing it in a html5 application see

Using the SAP HCP User API in SAP Web IDE

To utilize this service in a Mobile Services application we can perform the following

STEP 1: Create HTML5 App

To utilize this service in Mobile Services we first need to create an html5 app that exposes access to the service.  The only requirement for this app is to have a route defined in it’s neo-app.json for the userapi service.  You can either follow the above mentioned blog, add to any existing app running on the Cloud Platform or create a new UI5 app in Web IDE and add the following entry in the neo-app.json

{ "path": "/services/userapi", "target": { "type": "service", "name": "userapi" } }

After making the change deploy the app to the Cloud Platform.  This can be done in Web IDE by right clicking on the app and choosing Deploy -> Deploy to SAP Cloud Platform.  In my case I have provided the app name userapi.

STEP 2: Add connection in Mobile Services Development & Operations

In Mobile Service for Development and Operations choose the menu option Connections.  Add a new connection that points to your app with /services/userapi appended to the url as shown

Set the SSO Mechanism to Application To Application SSO

Add this connection to the desired application by choosing the tab Back End of the desired application and adding the connection to the Application Connections section

STEP 3: Finalize/Test Mobile Services Application

This scenario requires that you are using SAML authentication for the Mobile Services application.  This can be done by setting the Security Configuration property, found under the Information tab, of the app to Form.  For more information regarding the use of SAML with Kapsel application see

https://blogs.sap.com/2017/02/02/appendix-d-saml/

You should now be able to use this connection within your Kapsel app.  An example of accessing the CurrentUser would be as follows.

https://hcpms-XXXXXtrial.hanatrial.ondemand.com/userapi/currentUser

New NetWeaver Information at SAP.com

Very Helpfull

User Rating: Be the first one !