cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to access Logged in User Information in BTP Launchpad

rohitrohi
Explorer
0 Likes
760

Hi All,

How to access Logged in User Information in BTP Launchpad ?

I have created a Custom Fiori Application, which needs to send logged in user details (USER ID) which needs to be send in POST payload.

I have tried multiple solutions like mentioned below but nothing worked:

https://blogs.sap.com/2021/08/02/getting-user-information-in-btp-launchpad/

below mentioned piece of code worked locally but is not working in BTP Launchpad:

{ // In Controller
  doSomethingUserDetails: async function() {
    const oUserInfo = await this.getUserInfoService();
    const sUserId = oUserInfo.getId(); // And in SAPUI5 1.86, those became public: .getEmail(), .getFirstName(), .getLastName(), .getFullName(), ... 
    // ...
  },
  
  getUserInfoService: function() {
    return new Promise(resolve => sap.ui.require([
      "sap/ushell/library"
    ], oSapUshellLib => {
      const oContainer = oSapUshellLib.Container;
      const pService = oContainer.getServiceAsync("UserInfo"); // .getService is deprecated!
      resolve(pService);
    })); 

},

can anyone please help me with the solution?

i need to get the logged in user information from BTP Launchpad after accessing my application.

Thanks & Regards

Rohit R

Accepted Solutions (0)

Answers (0)