未经授权的Twilio可印记语音响应

时间:2019-01-08 12:15:09

标签: react-native twilio-api twilio-functions

我正在尝试使用以下代码设置twilio帐户并添加功能:

exports.handler = function(context, event, callback) {
    //let twiml = new Twilio.twiml.VoiceResponse();
    //callback(null, twiml);
    callback(null,{data:context});
    //Start Rahul Mishra here
       const AccessToken = Twilio.jwt.AccessToken;
       const VoiceGrant = AccessToken.VoiceGrant;

       const token = new AccessToken(context.ACCOUNT_SID, context.API_KEY, context.API_SECRET);
       token.identity = event.identity;

       const voiceGrant = new VoiceGrant({
           room:'DailyStandup'
       });
       token.addGrant(voiceGrant);

       callback(null, {token: token.toJwt() });
    //End here

};

以下是响应:

Unauthorized - you do not have permission to perform this request

请让我知道我在做什么错...谢谢!

0 个答案:

没有答案