cancel
Showing results for 
Search instead for 
Did you mean: 

Getting current user in Cloud Platform Integration(CPI)

john_knight00
Explorer

We are setting up an oData service in CPI and we need to know the user details (login name) that consumes the service. The overall solution is an end user using an Fiori app in SCP and call an oData service built in CPI (CPI is also relying authentication on IAS) and consume data from a third party system filtered by the current user in HCI.

As CPI is authenticating on IAS, one solution would be to consume the API from IAS and get the current user details. The problem with this approach is that I have not found an easy way to do this.

I have used before in SAPUI5 appa the destination mentioned in Accessing the User API, but this approach does not provide me a neat URL to be called from CPI.

Another approach would be to use the IAS API but the service requires as an input parameter the user ID, which is actually what I am trying to obtain. I have not found an API to get the current session user. So I ruled this one out, too.

The last option I just came up with (and not clean!) would try to access the HTML from https://ias_tenant.accounts.ondemand.com and parse the HTML to get data from here. Obviously, it is not a safe-play but it could resolve for the time being the requirement.

Any new ideas or built-in properties or API I could use?

Cheers

Accepted Solutions (0)

Answers (2)

Answers (2)

john_knight00
Explorer

Just stumbled across an interesting solution myself. I noticed there was a "Download" button in the profile data URL in IAS: https://ias-tenant.accounts.ondemand.com (replace ias-tenant with your IAS tenant ID.

If you click it, it calls a URL that will return a JSON with the entire profile data on current session:

The URL is: https://ias-tenant.accounts.ondemand.com/ui/protected/userData/json

bhalchandraswcg
Contributor
0 Kudos

Hi john.knight00,

Header 'SapAuthenticatedUserName' has User name of the client that calls the integration flow.

Hope this helps,

Bala