Skip to main content

Hi,

I am trying to invoke a REST endpoint using OAuth2 Client credentials in IFS Cloud 22R2. But it ends up with a 401 Unauthorized access error.

It works in Postman for the below configuration.

Does anyone have an idea of what I am missing? Or anything else that I could check to figure out what is going wrong? Any help is much appreciated.

I’ve tried out some of the things mentioned in earlier community posts, but with no luck yet. One thing I could notice was that the “Client Authentication” in Postman config is set as “Send as Basic Auth Header” and when I changed it to “Send client credentials in body” the retrieval of the token didn’t work and I wonder if IFS by default use that Client Authentication type.

 

Thank you

Hi @Novishan Dissanayake,

Have you tried specifying the headers  you see in Postman in the “Additional Headers” field under Rest Address Data?

Hope this helps!


Hi Novishan,

Hope “RESTful API Integration Development Overview - IFS Cloud 21R1” Self-paced training in IFS Academy will help you.

https://ifs.sabacloud.com/Saba/Web_spf/EU2PRD0185/app/me/learningeventdetail/cours000000000008643?regId=regdw000000000779274&learnerId=persn000000000419092

 

Best Regards,
Binura.


Hi @Charith Epitawatta,

Thank you for the input. Yes, I tried adding the headers to the Routing Address but it wasn’t a success.

 

Best Regards,

Novishan


Hi @Binura Dodangoda,

Thank you for the input. The suggested link says about accessing an IFS projection itself but our question lies with accessing a third-party API endpoint.

 

Best Regards,

Novishan


Solution: With the help of a teammate, we were able to retrieve the access token and it was done by adding the http_req_headers and query_parameters to the Rest Sender method in the code.


Hi @Novishan Dissanayake 

 

I'm having trouble too, so could you please provide the source details and a hard copy of the routing address?

 

Best Regards,

Midori

 


Hi @Novishan Dissanayake, @NECMIOH,

Turns out this occurs because IFS sends client credentials in both the request header and the body and some authentication providers do not support that, which causes the 401 error. In Postman you can control where to send the credentials, which is why you were not getting the error.

This is now fixed in IFSAPP10 UPD22 via patch ID 167255. This patch introduces a new property to control whether the client credentials will be sent in the request header or the body or both.

Property - ifs.includeClientCredentials

Expected values - body|header|both

Eg: ifs.includeClientCredentials: header

You can add the property in following 2 ways. 

  1. Add it to the ifs.properties file located in \\<IFS_HOME>\instance\<InstanceID>\conf directory.
  2. Add it to J2EE server properties via IEE client as described in this documentation.

Hope this helps!


@Charith Epitawatta 

Thank you for the information.
In my case, this problem occurs with IFSCloud23R4.

 

Best Regards,

Midori


All, is this now sorted in IFS Cloud versions ?


Reply