cancel
Showing results for 
Search instead for 
Did you mean: 

OAuth request is failing in CPI using standard integration(Replicate B2B Customer From S4HANA To SAP

UppalaPraneeth
Discoverer
0 Kudos
203

Hi All,
Good Evening!

We are configuring a standard integration Replicate B2B Customer From S4HANA To SAP Commerce Cloud. Which is a part of this package - SAP Commerce Cloud Integration with SAP S/4HANA.

We are facing these errors-

1. com.sap.gateway.core.ip.component.odata.exception.OsciException: Error in retrieving Authorization header, cause: java.lang.IllegalArgumentException: Status code:400; Reason:{
"error" : "invalid_request",
"error_description" : "Missing grant type"
}


2. com.sap.gateway.core.ip.component.odata.exception.OsciException: Attempted read from closed stream., cause: java.io.IO Exception: Attempted read from closed stream.

3. com.sap.gateway.core.ip.component.odata.exception.OsciException: Error in retrieving Authorization header, cause: java.lang.IllegalArgumentException: Status code:401; Reason:{"error":"invalid_client","error_description":"Bad client credentials"}


Please note that when we use HTTPS adapter in the receiver system it will works fine and data successfully passed from CPI to Commerce cloud.

OAuth Clients settings given to us from functional team from Back office. Could you please help us with configuration details to mitigate this issue.Error Screenshot 1.pngError Screenshot 2.pngError Screenshot 3.pngBack Office.png

View Entire Topic
Robert-Peter
Explorer
0 Kudos

Ushhh.... looks like you try to cover multiple errors in one thread. But let's address one by one. 

  • Missing Grant Type: Ensure that your OAuth token request includes the grant_type parameter with the appropriate value. For instance, when using the client credentials grant type, your request body should contain grant_type=client_credentials.​ I can recommend following SAP Knowledge Base article: https://userapps.support.sap.com/sap/support/knowledge/en/3142922?utm_source=chatgpt.com
  • Error while reading from closed stream: This error typically occurs when the input stream has been consumed or closed before it can be read, often due to previous errors in the integration flow. I would check the steps in your CPI integration flow. Typically there lies an error - you can start by implementing proper error handling.
  • Invalid Client Credentials: Please check the client ID and client secret configured in CPI and see if it matches those defined in SAP Commerce Cloud. Follow these steps:
    1) Confirm that the client ID and client secret configured in CPI match those defined in SAP Commerce Cloud.
    2) If not already done, set up an OAuth client in SAP Commerce Cloud. 
    Ensure there is no typo... Further more, consult the configuration steps to define the OAuth Client outlined in SAP help: https://help.sap.com/docs/SAP_COMMERCE_CLOUD_PUBLIC_CLOUD/aa417173fe4a4ba5a473c93eb730a417/627c92db2...

I hope it helps!

UppalaPraneeth
Discoverer
0 Kudos
Hi Robert - Yes the issue is resolved now. This issue was with Commerce cloud connection and input payload data. Thankyou for support and Guidance. I really appreciate it