gpt4 book ai didi

azure - 为什么逻辑应用检索 Content-Type 如果传递的话必须是 application/x-www-form-urlencoded ?

转载 作者:行者123 更新时间:2023-12-03 06:11:45 24 4
gpt4 key购买 nike

我正在开发一个逻辑应用程序,它应该每天调用一次特定的 API 来检索响应( token ),在接下来的步骤(尚未编写)中,它将联系另一个 API,最后它将存储Google 电子表格上的结果。问题出在第一次调用时,阅读 MailUp 的文档时,我必须向 URL 发送调用以使用用户名 e 密码身份验证( https://help.mailup.com/display/mailupapi/Authenticating+with+OAuth+v2 )检索 token ,但它不起作用!有人可以帮助我吗?

{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"HTTP": {
"inputs": {
"headers": {
"Authorization": "BASE64_ENCODED_CLIENTCREDENTIALS",
"Content-Type": "application/x-www-form-urlencoded"
},
"method": "POST",
"queries": {
"grant_type": "password",
"password": "password",
"username": "username"
},
"uri": "https://services.mailup.com/Authorization/OAuth/Token"
},
"runAfter": {
"Initialize_variable": [
"Succeeded"
]
},
"type": "Http"
},
"Initialize_variable": {
"inputs": {
"variables": [
{
"name": "responseBody",
"type": "String",
"value": ""
}
]
},
"runAfter": {},
"type": "InitializeVariable"
},
"type": "ApiConnection"
},
"Set_variable": {
"inputs": {
"name": "responseBody",
"value": "@{body('HTTP')}"
},
"runAfter": {
"HTTP": [
"Succeeded"
]
},
"type": "SetVariable"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"Recurrence": {
"evaluatedRecurrence": {
"frequency": "Day",
"interval": 1
},
"recurrence": {
"frequency": "Day",
"interval": 1
},
"type": "Recurrence"
}
}
},
"parameters": {
"$connections": {
"value": {
}
}
}
}

最佳答案

由于访问问题,我将无法使用https://help.mailup.com/display/mailupapi/Authenticating+with+OAuth+v2在这里,但我将使用 https://login.microsoft.com/{tenant_id}/oauth2/token以与您尝试在逻辑应用中生成不记名 token 相同的方式生成不记名 token 。

enter image description here

尝试按照以下格式构建正文,例如在您的情况下使用'&'而不是'逗号'。也使用 clientId 和 client_password 以及用户名和密码。在这里,我采用以下输入来生成 token :

网址 https://login.microsoft.com/{tenant_id}/oauth2/token

header Content-Type: application/x-www-form-urlencoded

正文grant_type=password&resource=https://graph.microsoft.com&client_id=<your client ID>&client_secret=<your client secret>&username=<username>&password=<password>

enter image description here

<强> Output

enter image description here

enter image description here

如果您引用上述步骤,您也将能够生成访问 token 和刷新 token 。

关于azure - 为什么逻辑应用检索 Content-Type 如果传递的话必须是 application/x-www-form-urlencoded ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76702944/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com