node-webot / co-wechat-api

Wechat API. Support Async Functions
Other
723 stars 170 forks source link

不定期的token失效 #18

Closed helloyou2012 closed 8 years ago

helloyou2012 commented 8 years ago

错误日志如下:

WeChatAPIError: invalid credential, access_token is invalid or not latest hint: [j0563vr23]
      at API.request (/xxxxx/node_modules/co-wechat-api/lib/api_common.js:122:17)
      at next (native)
      at exports.getTicket (/xxxxx/node_modules/co-wechat-api/lib/api_js.js:74:26)
      at next (native)
      at exports.ensureTicket (/xxxxx/node_modules/co-wechat-api/lib/api_js.js:160:26)
      at next (native)
      at exports.getJsConfig (/xxxxx/node_modules/co-wechat-api/lib/api_js.js:179:28)
      at next (native)
      at onFulfilled (/xxxxx/node_modules/co/index.js:65:19)
      at process._tickDomainCallback (node.js:409:9)
nick-ma commented 8 years ago

这种情况跟这个库没有直接关系。 请检查一下是否有别的地方同时请求了access token,导致微信服务器发放了新的access token给别人。

helloyou2012 commented 8 years ago

了解了,别的地方请求token导致存在文件中的token过期。发生这种情况时,是否需要对过期的token更新下过期日期?

nick-ma commented 8 years ago

只要把token信息删除即可,api会自动帮你重新获取一个最新的。