Javen205 / TNWX

TNWX: TypeScript + Node.js + WeiXin 微信系开发脚手架,支持微信公众号、微信支付、微信小游戏、微信小程序、企业微信/企业号。最最最重要的是能快速的集成至任何 Node.js 框架(Express、Nest、Egg、Koa 等)
Apache License 2.0
642 stars 97 forks source link

jssdk 签名使用缓存中的 accesstoken 间隔一段时间会签名失败 #25

Closed huixisheng closed 3 years ago

huixisheng commented 4 years ago

版本信息

报错信息 (注意格式化)

大致实现的伪代码:

    const qyApiConfig = new ApiConfig(agentId, appScrect, 'anytoken', true, '', corpId);

    QyApiConfigKit.putApiConfig(qyApiConfig);
    QyApiConfigKit.devMode = true;
    QyApiConfigKit.setCurrentAppId(qyApiConfig.getAppId, qyApiConfig.getCorpId);
    await QyAccessTokenApi.getAccessToken();

    ...
    const jssdkConfig = await this.appSerice.fetchQyJsSdkConfig(currentUrl);

  async fetchQyJsSdkConfig(url) {
    const corpId = 'xxx';
    const timestamp = new Date().getTime().toString();
    const nonceStr: string = uuid.v1();
    const signature = await QyWeChat.jssdkSignature(nonceStr, timestamp, url, QyJsApiType.CORP);
    ...
}

问题描述(包括回显步骤、截图 )

如上代码调用,隔段时间使用缓存中的 accesstoken 就会有问题

huixisheng commented 3 years ago

https://github.com/Javen205/TNWX/issues/24 重复