0

需要你的帮助!

目标:调用一个 API,该 API 将生成一个主体类型为 x-form-urlencoded 的令牌。

结果:400-错误请求

到目前为止,我们所做的是 ff:

  1. 在调用属性 (to) 中指明 Content-Type :apppication/x-form-urlencoded。
  2. 在如下变量中分配 grant_type 和 assertion 的值。

grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer&assertion=eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiAiM01WRzlMekt4YTQzenFkSWR4TGJaRVlQOUFnMzNOS0FGcVJ6aDdRM21hTWRJSjAwVmxMakI4bE5oaFRMN0M1Tm1OT0M4eUN6c1F1RUdEbVlVcTVzVyIsICJzdWIiOiAisdasdbi5sb3JlbnpvQGhvZWdoLmNvbS5zb2FhdXRoIiwgImF1ZCI6ICJodHRwczovL3Rlc3Quc2FsZXNmb3JjZS5jb20iLCAiZXhwIjogIjE2Mjk5NDQwMDcifQ.JiAEVW0sP96If24-oYTiCVMK8oyDlo_xfT4Yei44AYAwH0trfRtJCDZOsuDdOLkdAz0kRValqrPcOuPzPIfyWtrSAHU0bUWwmAc9XK5pV4MLgfKuZ_AfkLSygdu0Z9Tk9eG4WYyj953STNY316vTXQwa_uWG

  1. 在踪迹中。& 转换为 '&' 不确定这是否是这里的问题。我们确定断言密钥是有效的,邮递员/soapui 尝试调用 api。

<messages><input> <urlEncoded><urlEncoded xmlns:def="http://www.w3.org/2001/XMLSchema" xsi:type="def:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer&amp;amp;assertion=eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiAiM01WRzlMekt4YTQzenFkSWR4TGJaRVlQOUFnMzNOS0FGcVJ6aDdRM21hTWRJSjAwVmxMakI4bE5oaFRMN0M1Tm1OT0M4eUN6c1F1RUdEbVlVcTVzVyIsICJzdWIiOiAiam9obi5sb3JlbnpvQGhvZWdoLmNvbS5zb2FhdXRoIiwgImF1ZCI6ICJodHRwczovL3Rlc3Quc2FsZXNmb3JjZS5jb20iLCAiZXhwIjogIjE2Mjk5NDQwMDcifQ.JiAEVW0sP96If24-oYTiCVMK8oyDlo_adadsAwH0trfRtJCDZOsuDdOLkdAz0kRValqrPcOuPzPIfyWtrSAHU0bUWwmAc9XK5pV4MLgfKuZ_AfkLSygdu0Z9Tk9eG4WYyj953STNY316vTXQwa_uWGAb2bsfVWWX1Jvdjwc3oSGtKfZl4IaVVAvIYnVWVrTgrY80M0LQhDBp5UKkTzI-Mam_NaRN30GFlwrJipwFPgm8t-eJ__FU-srpLO4LZG5FBseUOLVtnmrDlxPm7l_i8ee8vKTzNvgySLt0hVC4C1e51xFY4OSkNMa6E3jF-YnEkJJERMW82fFozalg</urlEncoded></urlEncoded></input><fault> <bpelFault><faultType>0</faultType><bindingFault xmlns="http://schemas.oracle.com/bpel/extension"><part name="summary"><summary>Bad Request</summary></part><part name="code"><code>400</code></part><part name="detail"><detail>{"error":"unsupported_grant_type","error_description":"grant type not supported"}</detail></part></bindingFault></bpelFault></fault><faultType> <message>0</message></faultType></messages>

  1. 此外,我们还尝试使用 oracle 的 toCdata 将授权类型和断言包装在 cdata 中,但没有成功!!!啊!

<messages><input> <urlEncoded><urlEncoded xmlns:def="http://www.w3.org/2001/XMLSchema" xsi:type="def:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><![CDATA[grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer&assertion=eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiAiM01WRzlMekt4YTQzenFkSWR4TGJaRVlQOUFnMzNOS0FGcVJ6aDdRM21hTWRJSjAwVmxMakI4bE5oaFRMN0M1Tm1OT0M4eUN6c1F1RUdEbVlVcTVzVyIsICJzdWIiOiAiam9obi5sb3JlbnpvQGhvZWdoLmNvbS5zb2FhdXRoIiwgImF1ZCI6ICJodHRwczovL3Rlc3Quc2FsZXNmb3JjZS5jb20iLCAiZXhwIjogIjE2Mjk5NDUwMzkifQ.oi4LFRjX_iF-9tRCzvlLO-JJLg4xMDMnLSHXCz627LqYaC0UqYe2gsUEPZJ8Wpa-5SyosWJLkAp7T98Bpy-JqHni5jL4Ef50zsJ8gXloThhdB3LIMsQ3nZ4tpoP_4tYoa8Tc90oma3hlbZ_9GnGh19oy3eLsxr0odZA5cEFWwyxs20vb4XJ0za0RxeO3-bcH2M9k904mzTPZVM4x7MqJW--EHYhaLwYJj__HHsLvpFI6iP0vcc1FcTbjbDZsvBsMS_F5L6RYbOiua2rTV4FHdqi085-x_qms2yEMxhGdYSZFEIMzaoe9TMYpWIMZ34Dfjj84t0bCIXWL5ZVfdH3tcQ]]></urlEncoded></urlEncoded></input><fault> <bpelFault><faultType>0</faultType><bindingFault xmlns="http://schemas.oracle.com/bpel/extension"><part name="summary"><summary>Bad Request</summary></part><part name="code"><code>400</code></part><part name="detail"><detail>{"error":"unsupported_grant_type","error_description":"grant type not supported"}</detail></part></bindingFault></bpelFault></fault><faultType> <message>0</message></faultType></messages>

Anyyyy建议/推荐?

4

1 回答 1

0

解决方案:

  1. 在参考泳道中,确保在请求有效负载中选择了 url 编码。添加 grant_type 和断言作为查询参数。
  2. 在 bpel,invoke > property 选项卡中,选择 rest.query.grant_type 值是 urn:ietf:params:oauth:grant-type:jwt-bearer 。在断言中执行相同的过程。
于 2021-08-27T03:36:07.007 回答