cancel
Showing results for 
Search instead for 
Did you mean: 

CPI: Accessing MessageProcessingLogs OData API via OAuth

babruvahana
Contributor
3,964

Hi Experts,

I am working on a POC for generating a CPI monitoring report and I need to access MessageProcessingLogs OData API via OAuth.

I have followed the blog for OAuth set up: https://blogs.sap.com/2019/02/14/cloud-integration-inbound-http-connections-using-oauth-client-crede... and it works fine when tested using POSTMAN tool.

I have stored the OAuth credentials in Security Materials and have done OData adapter configuration. When iFlow is deployed. It is failing with "com.sap.gateway.core.ip.component.odata.exception.OsciException: : 401 : HTTP/1.1" error.

I have tried unchecking CSRF protected option and checked my Client Secret multiple times and it has ESBMessaging.send role assigned too.

Any pointers would be a great help.

Regards,

Pavan G

OData Adapter Config:

View Entire Topic
joost_stallaert3
Discoverer
0 Kudos

Apparently the CPI Internal API only supports "basic auth"...

See 2768194 - Authorization to CPI internal Odata API.

That's a bummer

jravnik
Participant
0 Kudos

Hi Joost,

the OData API of the CPI does work with OAuth2 Bearer Token. You can try it with Postman, for example.

I just haven't got it to work with the OAuth2 Client Credentials as in the original post. I therefore took the work around and just used a HTTPS Receiver Adapter to retrieve the Bearer Token manually (Authentication set to 'Basic') and then set it as the Authorization header via a Groovy script. After that I used the OData Receiver Adapter with Authentication set to 'None'.

It seems like the grant_type=client_credentials query parameters are getting messed up or lost in the OData Receiver Adapter when the Authentication is set to 'OAuth2 Client Credentials', as I always got this response: {"error":"unsupported_grant_type","error_description":"Unexpected request grant type."}

Best regards
Jürgen

Ayushi_Dhar
Discoverer
0 Kudos
Hi Jürgen, for me it is throwing error getting the token is success but hitting the log API results in 401 error
Ayushi_Dhar
Discoverer
0 Kudos
i added bearer token on groovy script and set no auth odata. I have removed CSRF Protected from odata