Azure 事件 Webhook 验证失败
Azure event Webhook validation failed
我正在尝试使用 Azure Events 验证 Webhook。根据他们的文档,请求正文如下:
[
{
"id": "2d1781af-3a4c-4d7c-bd0c-e34b19da4e66",
"topic": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"subject": "",
"data": {
"validationCode": "512d38b6-c7b8-40c8-89fe-f46f9e9622b6",
"validationUrl": "https://rp-eastus2.eventgrid.azure.net:553/eventsubscriptions/estest/validate?id=512d38b6-c7b8-40c8-89fe-f46f9e9622b6&t=2018-04-26T20:30:54.4538837Z&apiVersion=2018-05-01-preview&token=1A1A1A1A"
},
"eventType": "Microsoft.EventGrid.SubscriptionValidationEvent",
"eventTime": "2018-01-25T22:12:19.4556811Z",
"metadataVersion": "1",
"dataVersion": "1"
}
]
应该return:
{
"validationResponse": "512d38b6-c7b8-40c8-89fe-f46f9e9622b6"
}
我已与邮递员确认我的应用程序确实如此。这是一个片段:
const validationEventType = 'Microsoft.EventGrid.SubscriptionValidationEvent';
for (var events in req.body) {
const body = req.body[events];
// Validate the event-hook when the eventhook is created
if (body.data && body.eventType === validationEventType) {
const code = body.data.validationCode;
const resBody = { validationResponse: code };
return res.status(200).json(resBody);
}
当我尝试用 Azure 验证它时,我仍然收到以下错误消息:
Webhook 验证握手失败 https://.ngrok.io/v*./api //媒体工作。
Http POST 请求返回带有响应正文的 2XX 响应
{“验证响应”:“301549B7-E5A7-4D5B-9D35-8A4CAD6D9494”。
当在响应正文中没有验证代码的情况下接受验证请求时,Http GET 预计在验证事件中包含的验证 url(10 分钟内)。用于故障排除*
任何可能导致此问题的想法?
我找到了修复程序,但是,我不完全确定错误是什么。我在我的请求中看到我有很多 headers,例如 set-cookie
,X-...
将路由器移动到不使用 cookie-parser,passport cors,头盔删除了很多 cookie并使握手按预期工作。
我正在尝试使用 Azure Events 验证 Webhook。根据他们的文档,请求正文如下:
[
{
"id": "2d1781af-3a4c-4d7c-bd0c-e34b19da4e66",
"topic": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"subject": "",
"data": {
"validationCode": "512d38b6-c7b8-40c8-89fe-f46f9e9622b6",
"validationUrl": "https://rp-eastus2.eventgrid.azure.net:553/eventsubscriptions/estest/validate?id=512d38b6-c7b8-40c8-89fe-f46f9e9622b6&t=2018-04-26T20:30:54.4538837Z&apiVersion=2018-05-01-preview&token=1A1A1A1A"
},
"eventType": "Microsoft.EventGrid.SubscriptionValidationEvent",
"eventTime": "2018-01-25T22:12:19.4556811Z",
"metadataVersion": "1",
"dataVersion": "1"
}
]
应该return:
{
"validationResponse": "512d38b6-c7b8-40c8-89fe-f46f9e9622b6"
}
我已与邮递员确认我的应用程序确实如此。这是一个片段:
const validationEventType = 'Microsoft.EventGrid.SubscriptionValidationEvent';
for (var events in req.body) {
const body = req.body[events];
// Validate the event-hook when the eventhook is created
if (body.data && body.eventType === validationEventType) {
const code = body.data.validationCode;
const resBody = { validationResponse: code };
return res.status(200).json(resBody);
}
当我尝试用 Azure 验证它时,我仍然收到以下错误消息:
Webhook 验证握手失败 https://.ngrok.io/v*./api //媒体工作。 Http POST 请求返回带有响应正文的 2XX 响应 {“验证响应”:“301549B7-E5A7-4D5B-9D35-8A4CAD6D9494”。 当在响应正文中没有验证代码的情况下接受验证请求时,Http GET 预计在验证事件中包含的验证 url(10 分钟内)。用于故障排除*
任何可能导致此问题的想法?
我找到了修复程序,但是,我不完全确定错误是什么。我在我的请求中看到我有很多 headers,例如 set-cookie
,X-...
将路由器移动到不使用 cookie-parser,passport cors,头盔删除了很多 cookie并使握手按预期工作。