0
votes

We want to implement Oauth autentication in IBM API Connect.

Default Oauth API has POST Token as consumes Types application/x-www-form-urlencoded and form as paremeters aswel but we need to execute the call inside an IBM Default Invoke event which is not supported.

We tried to modify POST to a GET and execute a call like

https://api.eu.apiconnect.ibmcloud.com/xxxxx/api-connect-oauth/oauth2/token?grant_type=client_credentials&scope=xxxx

But is not supported in Cloud. How can execute a token request inside a invoke execution.

Invoke Example

1

1 Answers

0
votes

In a GatewayScript action before the invoke action, try the following:

context.message.header.set('Content-Type', 'application/x-www-form-urlencoded')
context.message.body.write('grant_type=client_credentials&client_id=client&client_secret=secret')

Else you can also use the urlopen module in GatewayScript.