Jump to content

How to call external REST API using oAuth2 authentication


 Share

Recommended Posts

Hello All,

I am new to Sage X3 REST web services. I need to call external REST API of SAP CONCUR application using oAuth2 authentication method. Is there any help guide on how I can achieve this.

I am trying to read the data from SAP Concur system using REST API.

I tried to create a REST call from Sage X3 but there is no option on how i can set oAuth authentication. Attached is the screenshot.

 

Any sort of help is highly appreciable.

Thanks and Regards.

1.png

Link to comment
Share on other sites

  • 2 weeks later...

Hi Chitrans,

As far as I know, there is no oAuth2 authentication for external REST web services, but maybe you could pass some information on the code call that could embed that (not sure, just an option). You can look at the online help here with some sample calls:

https://online-help.sageerpx3.com/erp/12/staticpost/api-asyrrestcli/?highlight=asyrrestcli

Hope it helps!

Alex

Link to comment
Share on other sites

Hi Alex,

Thank you for the valuable comment!

I tried to pass the body with client connection details (client_id, client_secret, username, password, grant_type) in CDATA variable but it is not working.

Not sure but I think that I need to create an external connector out of Sage X3 which could authenticate external REST web services with oAuth2.

Warm Regards,

Chitransh

  • Like 1
Link to comment
Share on other sites

  • 4 weeks later...

Hi Chitransh,

from our experience, currently it's not possible to use OAuth2 with the EXEC_REST_WS function from ASYRRESTCLI library. The header parameters used in this library are to short to hold a bearer token. You can't fix that without changing the standard library. 

Another option (not so easy to implement) is to write a nodejs module that makes the external authentication and call. Then you execute the nodejs module from 4gl script with this library: https://online-help.sageerpx3.com/erp/12/staticpost/asyrwebser-api 

 

  • Like 1
Link to comment
Share on other sites

  • 1 year later...
  • 1 year later...
On 5/3/2021 at 2:57 PM, Delbert Friesen said:

Hi Chitransh,

from our experience, currently it's not possible to use OAuth2 with the EXEC_REST_WS function from ASYRRESTCLI library. The header parameters used in this library are to short to hold a bearer token. You can't fix that without changing the standard library. 

Another option (not so easy to implement) is to write a nodejs module that makes the external authentication and call. Then you execute the nodejs module from 4gl script with this library: https://online-help.sageerpx3.com/erp/12/staticpost/asyrwebser-api 

 

Hi
This is correct. There is a limitation at the moment in the X3 supervisor where the system building the HTTP header cannot have more than 255 characters. Having an oauth2 token will probably go beyond that.
An option is to build a simple middleware in nodejs for example, that X3 will call to pass parameter values and nidejs will make the actual call to SAP.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...