azure - 使用来自 HTTP 请求的响应数据到另一个 Azure

标签 azure azure-logic-apps

我正在 Azure 中设计一个逻辑应用程序,有什么方法可以发出两个这样的 HTTP 请求: 1.我正在调用我的 Identity Server 4 来获取新的访问 token 2.我想从第一个请求中获取访问 token ,将其放入 header 并用它调用.Net Core Api Endpoint?

谢谢

最佳答案

根据我的理解,您想知道如何从 JSON 对象中获取 access_token 值,该对象来自 get token http request 的响应。 我为你做了一个简单的演示: enter image description here

帖子请求的详细信息: enter image description here

这是一个在 Azure 中获取访问 token 的简单请求。响应将是:

{
    "token_type": "Bearer",
    "expires_in": "3600",
    "ext_expires_in": "3600",
    "expires_on": "1557995356",
    "not_before": "1557991456",
    "resource": "<-resource name->",
    "access_token": "<-value of access token->"
}

正如您所看到的,这个逻辑应用程序是由http请求触发的,它将执行一个post请求来获取包含access_token的JSON对象。最后它会在response中返回access_token值。

所以这里的关键是如何配置,以便我们可以从步骤2的JSON响应中获取access_token值。

让我们打开逻辑应用代码 View ,找到“response”=>“body”并将其值修改为:“@body('HTTP').access_token”

enter image description here

这样你就可以从之前的http请求的JSON响应中获取特定的参数: enter image description here

关于azure - 使用来自 HTTP 请求的响应数据到另一个 Azure,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56148106/

相关文章:

Azure API 管理将 http 请求重定向到 https

azure - VSTS 构建 + Azure 数据库 + Redgate ReadyRoll

azure - 如何在 Azure 表存储的 StorageCredentials 上使用 SAS?

azure - 如何授予应用程序创建 Azure 逻辑应用程序的权限

azure - 在 Azure 中使用 Kudu 控制台上传 .zip 文件/解压缩时出错

sql - 向 Azure 数据工厂中的表添加新列

azure - 逻辑应用订阅事件网格域内的主题

json - Azure 常见警报架构将 commonPropertie 设置为 "null"

具有逻辑应用程序重复触发器的Azure函数

azure - 可以将逻辑应用程序运行历史记录标识符放入逻辑应用程序操作输入字段中吗?