SubscriptionConfirmation请求中的Token或SubscribeUrl在哪里?

时间:2014-09-10 16:51:46

标签: javascript json node.js amazon-web-services amazon-sns

我尝试使用node.js接受来自SNS的订阅确认。

我将我的端点键入控制台并点击订阅。

The documentation

  

订阅HTTP / HTTPS端点后,Amazon SNS会向HTTP / HTTPS端点发送订阅确认消息。此消息包含您必须访问以确认订阅的SubscribeURL值(或者,您可以将令牌值与ConfirmSubscription一起使用)。

所以我这样做是为了预览请求,以便找到我需要的信息。

if(req.headers['x-amz-sns-message-type'] === 'SubscriptionConfirmation'){
    console.log('subscription confirmation requested',req.headers);
    console.log('body:',req.body);
    var arn = req.headers['x-amz-sns-subscription-arn'];
    var topic = req.headers['x-amz-sns-topic-arn'];
    res.send(200);
}

我无法在标题或正文中找到SubscribeUrl或Token。

包含req.body的控制台行只打印body: {} 包含req.headers的控制台行不包含SubscriptionUrl或Token

那它在哪里?

1 个答案:

答案 0 :(得分:2)

它在原始数据中,它就在哪里。

所以我必须this来获取数据,然后我才能访问它。