【发布时间】:2021-04-28 13:38:53
【问题描述】:
我正在尝试使用带有 Python 的 Bot Framework 创建一个聊天机器人。几天前我有这个工作,但现在我在 Azure 网络聊天中测试时遇到错误:KeyError: 'access_token'。使用来自here 的示例代码可以重现此问题。
如果我删除 config.py 中的应用程序 ID 和密码并在 localhost 上使用 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"
}
听起来 App ID 是错误的,但我通过从 Azure 门户、Bot Channels Registration、配置页面复制 Microsoft App ID 来验证它。我想可能是我输入了错误的密码,但如果是这种情况,我不知道如何更改它。
【问题讨论】:
-
你更新ngrok url了吗?
-
您可以根据@VinothRajendran 给出的答案更改密码
标签: python azure botframework