开发者社区> 问答> 正文

设备Coap对称加密自主接入,在设备设备认证流程总提示4.00错误(请求发送的Payload非法)

_无用_ 2019-01-20 10:32:38 354

使用node-coap 库进行设备Coap对称加密自主接入,在设备设备认证流程总提示4.00错误(请求发送的Payload非法),请问是怎么回事,谢谢。
代码:

const coap = require('coap');
var req = coap.request( {

    "host" : "a1NQ16kP2ol.coap.cn-shanghai.link.aliyuncs.com",
    "port" : 5682,
    "method" : "POST",
    "pathname" : "/auth",
    "headers" : {
    "Accept" : "application/json",
    "Content-Format" : "application/json"
}

});

var pp = {"productKey":"xxxx","deviceName":"xxxxxx","clientId":"A44E313FEAEC","sign":"1ed1d1f3472ef656a8c672afc89b3f48"};

req.write(JSON.stringify(pp));

req.on('response', function(res) {

console.log( JSON.stringify(res) );

res.pipe(process.stdout)
});

分享到
取消 提交回答
全部回答(1)
  • 1426694731350515
    2019-07-17 23:25:59

    路过

    0 0