我是 nodejs 的新手,我需要编辑 aws-chime-sdk 的示例代码以在加入会议之前构建自己的安全检查。
在 index 部分,在 handler.js 中,我的代码运行良好:
exports.index = async (event, context, callback) => {
// authorization code
return response(200,'text/html','message of authorized or not');
};
我能够检查用户是否已登录并显示/隐藏他们必须看到的内容。
但是在加入会议时,我无法让我的授权代码被执行,它似乎在跳转我的代码,甚至return response()
在第一行添加一个它没有执行,让我觉得我在编辑错误的地方。见下文:
exports.join = async (event, context, callback) => {
console.log("I'm passing by here"); //this never appears on my logs
return response(200,'text/html','test'); //this won't execute
// here is my authorization code
// other codes
let meeting = await getMeeting(query.title); // this is executed, the meeting is created
if (!meeting) {
// code for creating a new meeeting...
}
// and finally this seems to be returned, otherwise the meeting wouldn't work:
return response(200, 'application/json', JSON.stringify({
JoinInfo: {
Meeting: meeting,
Attendee: attendee,
},
}, null, 2));
};
由于 index.html 中加入会议的表单以 /join 作为目标,我认为exports.join
是放置检查代码的正确位置,但我猜该请求并未通过此代码。我需要的是解释这些申请是如何发生的,以便我可以尝试在正确的位置处理此授权检查。
非常感谢你。