【发布时间】:2016-10-22 09:57:27
【问题描述】:
我不确定 Twilio Authy 的 register_user() 的成功回调是否触发。在我的代码中
var authyUsrId;
//global.authyUsrId;
app.post('/forTwilio', function(req, res){
// send the received data to Twilio Authy
authy.register_user('maverick@example.com', '8753565612', '91', function(err, res){
//global.authyUsrId = 'world';
authyUsrId = 'world';
});
//res.set("Content-Type","application/json");
res.json({name: 'hello', msg: authyUsrId});
//res.json({name: 'hello', msg: global.authyUsrId});
});
虽然新用户已成功添加到 Authy 并且响应状态为 200。
我想将 authyUsrId 的值设置为 register_user() 的成功回调中的某个值,并在我发送给 POST 请求的 JSON 响应中使用它。
但在回复中我只得到这个
{name: 'hello'}
有什么方法可以调试特别是 register_user() 回调部分?
【问题讨论】:
标签: javascript node.js express twilio authy