为什么access_token明明没过期,调用subscribeMessage.send函数报错?
发布于 5 年前 作者 taoliu 7387 次浏览 来自 官方Issues

为什么access_token明明没过期,调用subscribeMessage.send函数的时候报 {“errcode”:40001,“errmsg”:“invalid credential, access_token is invalid or not latest hint: [G2mlda01330941!]”}错误? access token 获取时返回的数据为{“access_token”:“27_0WTyzNQ9HnLaiRYMedAinDYkXEPmLOAYSfrvR5QB77QDvicez2LNSvpXQ56l-OppBFnpAy_tJrt3bMCttNP5maZZktvOOz8WRfL8XcoWaF_JTfO4ZlVa_D_T9tUBFQdACAEIT”,“expires_in”:7200} 这儿的过期时间为2小时,我是定时115分钟进行access token更新一次

3 回复

不需要定时的,获取到token缓存,然后每次取token的时候判断一下

[2019-11-08T16:44:27.016] [ERROR] error - {“errcode”:40001,“errmsg”:“invalid credential, access_token is invalid or not latest hint: [34rrHA06669019!]”}

[2019-11-08T16:44:27.223] [ERROR] error - {“errcode”:40001,“errmsg”:“invalid credential, access_token is invalid or not latest hint: [Kd5dhA06671519!]”}

[2019-11-08T16:51:12.716] [ERROR] error - {“errcode”:40001,“errmsg”:“invalid credential, access_token is invalid or not latest hint: [d9qhAa00728738!]”}

[2019-11-08T16:57:32.020] [ERROR] error - {“errcode”:40001,“errmsg”:“invalid credential, access_token is invalid or not latest hint: [Zpp0ta04518593!]”}

[2019-11-08T16:57:32.222] [ERROR] error - {“errcode”:40001,“errmsg”:“invalid credential, access_token is invalid or not latest hint: [C1bYaa04528593!]”}

分别在16:44、16:51和 16:57执行了发送命令,过程中没有更新access token(有两个小程序access token),为什么16:51就只出错一次,而16:44和16:57就报了两次错?

你还得检查是不是另外某个地方重新获取了 access_token  特别是服务器做成了分布式后 没有注意这块东西

回到顶部