Twilio函数检索语音邮件TypeError:不建议使用参数auth使用`username` /`password`代替

问题描述

我试图从Get Recording使用示例,但收到错误消息:“ TypeError:不推荐使用参数auth。请改用username / password。” 我如何更改以下代码以使其工作。 这是我的代码:

const got = require('got');

//Boilerplate for function code
exports.handler = function(context,event,callback) {
    // Make an HTTP Request using a template literal for the Twilio API call
    //https://api.twilio.com/2010-04-01/Accounts/${context.ACCOUNT_SID}/Recordings.json
    got('https://api.twilio.com/2010-04-01/Accounts/${context.ACCOUNT_SID}/Recordings.json',{
        method:'get',auth: '${context.ACCOUNT_SID}:${context.AUTH_TOKEN}'
    })
    .then(res => {
        console.log(res);
        callback(null,res.body);
    })
    .catch(err => {
        console.log(err);
        callback(err);
    });
};

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)