首页 > 解决方案 > 将自定义授权令牌传递到 WSO2 中的后端没有给出预期的结果

问题描述

我正在使用 WSO2 APIM-2.6.0,我想传递一个自定义令牌。为此,我在中介策略 In flow 中使用了令牌交换机制。根据以下链接中 WSO2 文档中提供的说明,

https://apim.docs.wso2.com/en/latest/Learn/APIGateway/MessageMediation/passing-a-custom-authorization-token-to-the-backend/

使用的令牌交换 xml,

<sequence xmlns="http://ws.apache.org/ns/synapse" name="TokenExchange">
    <property name="Custom" expression="get-property('transport', 'Custom')"/>
    <property name="Authorization" expression="get-property('Custom')" scope="transport"/>
    <property name="Custom" scope="transport" action="remove"/>
</sequence>

在 API Store 的管理控制台上,当我在 header 参数中提供现有的不记名令牌并执行时,响应是,

TypeError: Failed to fetch
Code: 200

但是,当我从 API Store UI 复制相同的 curl 命令并通过命令提示符运行时,它会给出响应并且工作正常。我怎样才能解决这个问题?

标签: wso2wso2-am

解决方案


推荐阅读