-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
我有一个需求是需要做一个服务多个公众号的应用,
发现wechat的源码中,token是可以在前置中间件设置,但是
cryptor参数却不能在前置中间件设置:
不能动态的设置cryptor的参数,
if (this.encodingAESKey) {
that.cryptor = new WXBizMsgCrypt(this.token, this.encodingAESKey, this.appid);
}
// 动态token,在前置中间件中设置该值req.wechat_token,优先选用
if (!checkSignature(req.query, req.wechat_token || token)) {
是否可以把 设置cryptor参数的放到中间件函数中,如:
return function (req, res, next) {
if (req.query.encrypt_type && req.query.msg_signature) {
that.cryptor = new WXBizMsgCrypt(req.wechat_token.token, req.wechat_token.encodingAESKey, req.wechat_token.appid);
serveEncrypt(that, req, res, next, _respond);
Metadata
Metadata
Assignees
Labels
No labels