Question

Configuring REST Sender - OAuth 2.0 Client Credentials | IFS Cloud

  • 20 February 2023
  • 8 replies
  • 514 views

Userlevel 6
Badge +13

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


8 replies

Userlevel 7
Badge +31

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!

Userlevel 5
Badge +11

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.

Userlevel 6
Badge +13

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

Userlevel 6
Badge +13

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

Userlevel 6
Badge +13

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.

Userlevel 2
Badge +8

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

 

Userlevel 7
Badge +31

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!

Userlevel 2
Badge +8

@Charith Epitawatta 

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

 

Best Regards,

Midori

Reply