I am not sure whether the success callback of Twilio Authy's register_user()
is firing or not. In my code
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});
});
Although new user is being added successfully to Authy and the response status is 200.
I want to set the value of authyUsrId to something in the success callback of register_user()
and use it in the JSON response that I am sending to the POST request.
But in the response I am getting only this
{name: 'hello'}
Is there any way to debug particularly the register_user() callback portion?