我用for循环写了个循环调用发送微信公众号模板功能做为测试。经过测试经常出现{"errcode":40001,"errmsg":"invalid credential, access_token is invalid or not latest hints: [EjGBigaCe-lAmPRA!]"} 的问题。
神奇的是,同一样accesstoken,在5次调用中,两次失败。
我们系统的accesstoken是由统一获取调度的,每一次获取token时都会根据expir_time检查下有效性。所以不存在token无效的问题,而且为什么有的行,有的不行呢?
报文格式:"token:"+access_tokne+"||"+返回消息;
报文如下:
token:32_3ILiluV7RyHmcxMkUNFPuOygQTBu3B1zTQEZhGLO7ue1tkEQNxiG5Y4KShO_O6PTVgIoJ1-XNPGrzBhePWPl6ig508eX6uXz8DRYAISgrpu4r5n76EEM4GVxaHOAax3MvOm74KyRDPQ9VfljVSZiAAAROV||{"errcode":0,"errmsg":"ok","msgid":1296381152311394305}
token:32_3ILiluV7RyHmcxMkUNFPuOygQTBu3B1zTQEZhGLO7ue1tkEQNxiG5Y4KShO_O6PTVgIoJ1-XNPGrzBhePWPl6ig508eX6uXz8DRYAISgrpu4r5n76EEM4GVxaHOAax3MvOm74KyRDPQ9VfljVSZiAAAROV||{"errcode":40001,"errmsg":"invalid credential, access_token is invalid or not latest hints: [EjGBigaCe-lAmPRA!]"}
token:32_3ILiluV7RyHmcxMkUNFPuOygQTBu3B1zTQEZhGLO7ue1tkEQNxiG5Y4KShO_O6PTVgIoJ1-XNPGrzBhePWPl6ig508eX6uXz8DRYAISgrpu4r5n76EEM4GVxaHOAax3MvOm74KyRDPQ9VfljVSZiAAAROV||{"errcode":40001,"errmsg":"invalid credential, access_token is invalid or not latest hints: [EjGB0qLnRa-414NGa!]"}
token:32_3ILiluV7RyHmcxMkUNFPuOygQTBu3B1zTQEZhGLO7ue1tkEQNxiG5Y4KShO_O6PTVgIoJ1-XNPGrzBhePWPl6ig508eX6uXz8DRYAISgrpu4r5n76EEM4GVxaHOAax3MvOm74KyRDPQ9VfljVSZiAAAROV||{"errcode":0,"errmsg":"ok","msgid":1296381159424933892}
token:32_3ILiluV7RyHmcxMkUNFPuOygQTBu3B1zTQEZhGLO7ue1tkEQNxiG5Y4KShO_O6PTVgIoJ1-XNPGrzBhePWPl6ig508eX6uXz8DRYAISgrpu4r5n76EEM4GVxaHOAax3MvOm74KyRDPQ9VfljVSZiAAAROV||{"errcode":0,"errmsg":"ok","msgid":1296381161975070723}
¥¥这是今早的记录,惨不忍睹啊。。
你好,access_token的有效期目前为2个小时,需定时刷新,重复获取将导致上次获取的access_token失效。https://developers.weixin.qq.com/doc/offiaccount/Basic_Information/Get_access_token.html
我也是这样,太僵硬了
没做好缓存吧。
小程序模板消息已经下线了 这是公众号?