从模拟器启动我的机器人时出现问题 - BotFrameworkAdapter.processActivity():401 ERROR - NotBeforeError:jwt not active

问题描述 投票:0回答:1

我正在使用Microsoft Bot Framework for Node.js开发一个机器人。

我用一个新文件更改了.bot文件中的LUIS应用程序,然后我生成了一个新的botFileSecret,我用Bot框架模拟器在本地测试了我的机器人,一切正常。

然后,我收到了这个错误:

Error finding key for token.
Available keys: -----BEGIN RSA PUBLIC KEY-----
jwtTokenExtractor.ts:132
MIIBCgKCAQEAt3J1hnS4aRZaZGq5JUw1iKsHynCUV9lMBe2MDArXGeQlN+w8Xw9v
U6InqmPVvJsUVyUkKE0jzn4dYLcwbTuttQ0hmN+lzNfGol04KKMIVdtTs1P0wo/+
VyJ88EuWM3lvDxyTw1PLim14UJ1856zdp2/kZLOSy+B46K96ENJ8b2yCP/VHRTd3
...
-----END RSA PUBLIC KEY-----
JwtTokenExtractor.getIdentity:err!
jwtTokenExtractor.ts:69
NotBeforeError {name: "NotBeforeError", message: "jwt not active", date: Tue Apr 02 2019 09:58:08 GMT+0200 (Romance Dayligh…, stack: "NotBeforeError: jwt not active
    at Object.modul…"}
jwtTokenExtractor.ts:69
BotFrameworkAdapter.processActivity(): 401 ERROR - NotBeforeError: jwt not active
botFrameworkAdapter.ts:555
(node:1888) UnhandledPromiseRejectionWarning: Error: NotBeforeError: jwt not active
warning.js:18
    at BotFrameworkAdapter.processActivity (c:\Users\SP-Montassar\Desktop\quicktext\zoe2\node_modules\botbuilder\src\botFrameworkAdapter.ts:556:19)
    at <anonymous>
    at process._tickDomainCallback (internal/process/next_tick.js:229:7)
(node:1888) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
warning.js:18
(node:1888) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

经过研究,我在Bot Framework Docs上找到this article,解释如何解决机器人身份验证问题。

我跟进了步骤..

首先,我从Azure门户验证了应用程序ID和应用程序密码,然后删除了APP ID和应用程序密码。我已经确认机器人开始没问题。我通过commandLine发送了一个HTTP请求来检查身份验证:

curl -X POST \
  https://login.microsoftonline.com/botframework.com/oauth2/v2.0/token \
  -H 'Content-Type: application/x-www-form-urlencoded' \
-d 'grant_type=client_credentials&client_id=<APP_ID>&client_secret=<APP_PWD>&scope=https://api.botframework.com/.default'

我收到了有效访问令牌的回复:

{
    "token_type": "Bearer",
    "expires_in": 3600,
    "ext_expires_in": 3600,
    "access_token": "eyJ0eXAiOiJKV1QiLCJhbGGAKI..."
}

然后,我在本教程的第三步中被阻止,因为我仍然有上面的一些错误。

请问这个问题有什么帮助吗?

node.js azure botframework luis
1个回答
0
投票

只需为.bot文件创建一个新的botFileSecret即可解决此问题。

© www.soinside.com 2019 - 2024. All rights reserved.