【问题标题】:IBM API Connect Cloud Oauth APIIBM API Connect 云 Oauth API
【发布时间】:2020-06-17 11:53:39
【问题描述】:

我们想在 IBM API Connect 中实现 Oauth 身份验证。

默认 Oauth API 具有 POST Token 作为消费类型 application/x-www-form-urlencoded 和 form 作为参数,但我们需要在不支持的 IBM Default Invoke 事件中执行调用。

我们尝试将 POST 修改为 GET 并执行类似的调用

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

但在 Cloud 中不受支持。如何在调用执行中执行令牌请求。

Invoke Example

【问题讨论】:

    标签: api oauth invoke apiconnect


    【解决方案1】:

    在调用操作之前的 GatewayScript 操作中,尝试以下操作:

    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')
    

    您也可以在 GatewayScript 中使用 urlopen 模块。

    【讨论】:

      猜你喜欢
      • 2019-10-02
      • 2017-10-10
      • 2016-07-21
      • 2020-10-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-10
      • 1970-01-01
      相关资源
      最近更新 更多