Twilio函数检索语音邮件TypeError:不推荐使用参数'auth'。请改用“用户名”/“密码”

Twilio函数检索语音邮件TypeError:不推荐使用参数'auth'。请改用“用户名”/“密码”,twilio,twilio-functions,Twilio,Twilio Functions,我试图使用来自的示例,并收到错误消息:“TypeError:Parameterauth已弃用。请改用username/password。” 如何更改以下代码以使其工作。 这是我的密码: const got = require('got'); //Boilerplate for function code exports.handler = function(context, event, callback) { // Make an HTTP Request using a templ

我试图使用来自的示例,并收到错误消息:“TypeError:Parameter
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);
    });
};
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',
        username: context.ACCOUNT_SID,
        password: context.AUTH_TOKEN
    })
    .then(res => {
        console.log(res);
        callback(null, res.body);
    })
    .catch(err => {
        console.log(err);
        callback(err);
    });
};