Azure 逻辑应用程序:如何制作 x-www-form-encoded?

Pau*_*que 5 azure azure-logic-apps

我正在尝试使用Content-Type x-www-form-urlencoded发出请求,该请求在邮递员中完美运行,但在 Azure 逻辑应用程序中不起作用 我收到了缺少参数的错误请求响应,就像我不会发送任何内容一样。

我正在使用 Http 操作。

body值是param1=value1¶m2=value2,但我尝试了其他格式。

Rou*_*han 6

Try out the below solution . Its working for me .

concat(
'grant_type=',encodeUriComponent('authorization_code'),
'&client_id=',encodeUriComponent('xxx'),
'&client_secret=',encodeUriComponent('xxx'),
'&redirect_uri=',encodeUriComponent('xxx'),
'&scope=',encodeUriComponent('xxx'),
'&code=',encodeUriComponent(triggerOutputs()['relativePathParameters']['code'])).

Here code is dynamic parameter coming from the previous flow's query parameter.

NOTE : **Do not forget to specify in header as Content-Type ->>>> application/x-www-form-urlencoded**
Run Code Online (Sandbox Code Playgroud)


小智 6

HTTP Method: POST
URI : https://xxx/oauth2/token
Run Code Online (Sandbox Code Playgroud)

在标题部分中,添加以下内容类型:

Content-Type: application/x-www-form-urlencoded
Run Code Online (Sandbox Code Playgroud)

并在正文中添加:

grant_type=xxx&client_id=xxx&resource=xxx&client_secret=xxx
Run Code Online (Sandbox Code Playgroud)


Ass*_*son 1

首先,身体必须是:

{  param1=value1&param2=value2 }
Run Code Online (Sandbox Code Playgroud)

(即用 {} 括起来)

也就是说,value1 和 value2 应该进行 url 编码。如果它们是一个简单的字符串(例如 a_b),那么这将按原样找到,但如果是例如https://ab,则应转换为 https%3A%2F%2Fa.b

我发现执行此操作的最简单方法是使用https://www.urlencoder.org/进行转换。分别转换每个参数,并用转换后的值代替原始值。