访问令牌不会自动刷新

时间:2018-12-12 02:44:54

标签: oauth-2.0 mule httprequest access-token anypoint-studio

我在Mule HTTP Request Config(Mule运行时3.8.5)中使用OAuth2客户端凭据协议,这是我第一次进行设置,但似乎无法自动刷新访问令牌过期(每个令牌持续90分钟),它将返回error_description ='Access Token Expired'的有效负载。我想念什么?

<http:request-config name="HTTPS_Request_Configuration" protocol="HTTPS" host="${API.HOST}" port="${API.PORT}" tlsContext-ref="TLS_Configuration" doc:name="HTTP Request Configuration" responseTimeout="${RESPONSE.TIMEOUT}">
    <oauth2:client-credentials-grant-type clientId="${TOKEN.API.CLIENT_ID}" clientSecret="${TOKEN.API.CLIENT_SECRET}" tlsContext-ref="TLS_Configuration">
        <oauth2:token-request tokenUrl="https://${API.HOST}${TOKEN.API.PATH}" scopes="Entitlement_Request" refreshTokenWhen="#[payload.error_description == &quot;Access Token Expired&quot;]">
            <oauth2:token-response accessToken="#[json:access_token]" expiresIn="#[json:expires_in]"/>
        </oauth2:token-request>
    </oauth2:client-credentials-grant-type>
</http:request-config>

<until-successful maxRetries="2" millisBetweenRetries="3000" synchronous="true" doc:name="Until Successful" failureExpression="#[message.inboundProperties['http.reason'] != &quot;Bad Request&quot;]">
    <http:request config-ref="HTTPS_Request_Configuration" path="${DATA.API.PATH}" method="PATCH" doc:name="HTTP">
        <http:request-builder>
            <http:header headerName="Content-Type" value="application/json"/>
        </http:request-builder>
        <http:success-status-code-validator values="200..599"/>
    </http:request>
</until-successful>

0 个答案:

没有答案