How to get logged in user in SAP Cloud Platform (N...
Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
In this session, we will look at how to get the logged in user in SAP Cloud Platform (Neo environment)
Synopsis:
SAP Cloud Platform can be set up with any Identity Provider that supports SAML
When building SAPUI5 applications, we can require that users be authenticated against this Identity Provider
There may be many instances where you might want to display user specific messages on the home page (for example, some form of welcome message) - and for this you need to know the logged in user
Steps:
SAP Cloud Platform provides an userapi service that can readily give you the current logged in user
So it's just a matter of calling the userapi service from within your application and displaying the user information in the user interface
We could make a simple REST API call using the window's fetch command in our controller files