Azure 聊天机器人无法进行身份验证

时间:2021-04-28 00:14:47

标签: python azure botframework

我正在尝试使用 Bot Framework 和 Python 创建一个聊天机器人。几天前我有这个工作,但现在我在 Azure 网络聊天中测试时遇到错误:KeyError: 'access_token'。使用 here 中的示例代码可以重现此问题。

如果我删除 config.py 中的应用程序 ID 和密码,并在本地主机上使用 Bot Emulator 进行测试,则它可以正常工作。当我将这些变量更改为正确的值并通过 ngrok 进行测试时,它会因相同的异常而失败。

我尝试按照 here 所述使用 curl 检查凭据,但它返回了此错误。

{
    "error": "unauthorized_client",
    "error_description": "AADSTS700016: Application with identifier 'd720efc0-d9a3-4c7a-86ab-deed1a27739c' was not found in the directory 'botframework.com'. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You may have sent your authentication request to the wrong tenant.\r\nTrace ID: de49aeb5-f200-4427-89f9-973fe2d10701\r\nCorrelation ID: 400d7c55-5854-44a6-a1f1-5a1eb74889da\r\nTimestamp: 2021-04-28 00:00:44Z",
    "error_codes": [
        700016
    ],
    "timestamp": "2021-04-28 00:00:44Z",
    "trace_id": "de49aeb5-f200-4427-89f9-973fe2d10701",
    "correlation_id": "400d7c55-5854-44a6-a1f1-5a1eb74889da",
    "error_uri": "https://login.microsoftonline.com/error?code=700016"
}

这听起来像是应用程序 ID 错误,但我通过从 Azure 门户、机器人通道注册、配置页面复制 Microsoft 应用程序 ID 进行了验证。我想我的密码可能有误,但如果是这种情况,我不知道如何更改它。

1 个答案:

答案 0 :(得分:1)

  1. 可能会检查消息端点(ngrok url 是否正确)

  2. 更改密码

Azure -> Bot Channels Registration -> 配置 -> Micrsoft Id(Manage) 点击管理链接

客户机密 -> 新客户机密