azure 为什么逻辑应用程序检索Content-Type必须是application/x-www-form-urlencoded,如果它被传递?

7ajki6be  于 2023-08-07  发布在  其他
关注(0)|答案(1)|浏览(96)

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

{
    "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": {
            }
        }
    }
}

字符串

lh80um4z

lh80um4z1#

由于访问问题,我将无法在这里使用https://help.mailup.com/display/mailupapi/Authenticating+with+OAuth+v2,但我将使用https://login.microsoft.com/{tenant_id}/oauth2/token来生成承载令牌,方法与您在逻辑应用程序中尝试生成它们的方法相同。


的数据
试着用下面的格式来组织正文,比如在你的例子中使用**'&'而不是'comma'**。使用clientId和client_password沿着用户名和密码。在这里,我使用下面的输入来生成令牌:
网址https://login.microsoft.com/{tenant_id}/oauth2/token
集管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>


Output




如果您参考上述步骤,您将能够生成访问令牌和刷新令牌。

相关问题