Skip to Content
0
Jun 28, 2022 at 08:50 AM

Get Logged in User Details in Freestyle SAP UI5 App

98 Views

Hi,

I have created a Freestyle SAP UI5 application for a custom requirement. We will be using SAP IAS for SSO to the application. We would like to get the logged in user information in the app. I am trying with the following Approach. They are not working.

if (window.sap && window.sap.ushell && window.sap.ushell.Container && window.sap.ushell.Container.getUser()) {
	loggedInUser = window.sap.ushell.Container.getUser().getId().toUpperCase();
	console.log(loggedInUser);
}

if(sap & sap.ushell && sap.ushell.services && sap.ushell.services.UserInfo) {
	console.log(sap.ushell.services.UserInfo());
}

if(sap & sap.ushell && sap.ushell.Container) {
	console.log(sap.ushell.Container.getServiceAsync("UserInfo"));
}

None of the above code snippets are working. Please advise if there are any other options to get the logged in User details in the SAP Ui5 application. Let me know if any additional information is needed.

Best Regards

Ramana Reddy