收藏
回答

发消息时,提示access token,容易一会有效,一会失效,验证不通过

问题模块 框架类型 问题类型 API/组件名称 终端类型 微信版本 基础库版本
API和组件 小程序 Bug https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET 客户端 6.7.2 2.2.5

以下是截出的日记


2018-09-13 20:04:51 [5b9a526352ad7][140.207.54.76][info][wxRequest] 

GET url:https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=13_bteztr87NkD30lptXrpAaJBwH2ZLrd-9ui46SbahIE4WD1pq5n6vDRq_is-_f-8wsXZdvA5owtWbrlh7qss0bT5igAyPLNeIqsMDe3oOjjo0368VrzYJiS03lDIMuCBOWx9xNQgAwbRIx_wnQXAbAJAZGJ 

req:"{\"touser\":\"owG-A4niWetH_dTyowY_gSgbAKzA\",\"msgtype\":\"text\",\"text\":{\"content\":\"test\"}}" 

res:{"errcode":40001,"errmsg":"invalid credential, access_token is invalid or not latest hint: [oWnN.a02918938!]"} 



2018-09-13 20:08:32 [5b9a5340df532][140.207.54.76][info][wxRequest] 

GET url:https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=13_bteztr87NkD30lptXrpAaJBwH2ZLrd-9ui46SbahIE4WD1pq5n6vDRq_is-_f-8wsXZdvA5owtWbrlh7qss0bT5igAyPLNeIqsMDe3oOjjo0368VrzYJiS03lDIMuCBOWx9xNQgAwbRIx_wnQXAbAJAZGJ 

req:"{\"touser\":\"owG-A4niWetH_dTyowY_gSgbAKzA\",\"msgtype\":\"text\",\"text\":{\"content\":\"test\"}}" 

res:{"errcode":0,"errmsg":"ok"} 


2018-09-13 20:37:41 [5b9a5a150ccac][140.207.54.80][info][wxRequest] 

GET url:https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=13_bteztr87NkD30lptXrpAaJBwH2ZLrd-9ui46SbahIE4WD1pq5n6vDRq_is-_f-8wsXZdvA5owtWbrlh7qss0bT5igAyPLNeIqsMDe3oOjjo0368VrzYJiS03lDIMuCBOWx9xNQgAwbRIx_wnQXAbAJAZGJ 

req:"{\"touser\":\"owG-A4hvAWm1270w5MKwg4zG8_kI\",\"msgtype\":\"text\",\"text\":{\"content\":\"\u7231\u7c9f\u88d5\u8985Hi\u597d\u837b\u82b1\u5723\u6bbf\u73af\u7403\u7f51\u597d\u7684\"}}" 

res:{"errcode":0,"errmsg":"ok"} 



2018-09-13 20:37:54 [5b9a5a226e70c][140.207.54.75][info][wxRequest] 

GET url:https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=13_bteztr87NkD30lptXrpAaJBwH2ZLrd-9ui46SbahIE4WD1pq5n6vDRq_is-_f-8wsXZdvA5owtWbrlh7qss0bT5igAyPLNeIqsMDe3oOjjo0368VrzYJiS03lDIMuCBOWx9xNQgAwbRIx_wnQXAbAJAZGJ 

req:"{\"touser\":\"owG-A4niWetH_dTyowY_gSgbAKzA\",\"msgtype\":\"text\",\"text\":{\"content\":\"\u7231\u7c9f\u88d5\u8985Hi\u597d\u837b\u82b1\u5723\u6bbf\u73af\u7403\u7f51\u597d\u7684\"}}" 

res:{"errcode":40001,"errmsg":"invalid credential, access_token is invalid or not latest hint: [p48INA02741530!]"} 



2018-09-13 20:40:17 [5b9a5ab19585f][140.207.54.79][info][wxRequest] 

GET url:https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=13_bteztr87NkD30lptXrpAaJBwH2ZLrd-9ui46SbahIE4WD1pq5n6vDRq_is-_f-8wsXZdvA5owtWbrlh7qss0bT5igAyPLNeIqsMDe3oOjjo0368VrzYJiS03lDIMuCBOWx9xNQgAwbRIx_wnQXAbAJAZGJ 

req:"{\"touser\":\"owG-A4hvAWm1270w5MKwg4zG8_kI\",\"msgtype\":\"text\",\"text\":{\"content\":\"\u7231\u7c9f\u88d5\u8985Hi\u597d\u837b\u82b1\u5723\u6bbf\u73af\u7403\u7f51\u597d\u7684\"}}" 

res:{"errcode":40001,"errmsg":"invalid credential, access_token is invalid or not latest hint: [K68nca04171530!]"} 



2018-09-13 20:41:39 [5b9a5b03c4bfa][140.207.54.80][info][wxRequest] 

GET url:https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=13_bteztr87NkD30lptXrpAaJBwH2ZLrd-9ui46SbahIE4WD1pq5n6vDRq_is-_f-8wsXZdvA5owtWbrlh7qss0bT5igAyPLNeIqsMDe3oOjjo0368VrzYJiS03lDIMuCBOWx9xNQgAwbRIx_wnQXAbAJAZGJ 

req:"{\"touser\":\"owG-A4hvAWm1270w5MKwg4zG8_kI\",\"msgtype\":\"text\",\"text\":{\"content\":\"\u7231\u7c9f\u88d5\u8985Hi\u597d\u837b\u82b1\u5723\u6bbf\u73af\u7403\u7f51\u597d\u7684\"}}" 

res:{"errcode":0,"errmsg":"ok"} 



2018-09-13 20:53:31 [5b9a5dcb9620f][140.207.54.75][info][wxRequest] 

GET url:https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=13_fgNRFDBRCcehDaGdayppq1FT5Wer6p451KFJ36hzqf22N_aBzLFLWOx_eO1SbEVIE2VP8bwaGFLfcCvXVGG_O-1Hze-pRs-WE84l-r_0doZpYi2oHUmrDKiAEbMRZHhAAAJRZ 

req:"{\"touser\":\"owG-A4niWetH_dTyowY_gSgbAKzA\",\"msgtype\":\"text\",\"text\":{\"content\":\"\u7231\u7c9f\u88d5\u8985Hi\u597d\u837b\u82b1\u5723\u6bbf\u73af\u7403\u7f51\u597d\u7684\"}}" 

res:{"errcode":40001,"errmsg":"invalid credential, access_token is invalid or not latest hint: [2XM2IA02111530!]"} 


2018-09-13 20:56:13 [5b9a5e6d9bb36][140.207.54.75][info][wxRequest] 

GET url:https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=13_fgNRFDBRCcehDaGdayppq1FT5Wer6p451KFJ36hzqf22N_aBzLFLWOx_eO1SbEVIE2VP8bwaGFLfcCvXVGG_O-1Hze-pRs-WE84l-r_0doZpYi2oHUmrDKiAEbMRZHhAAAJRZ 

req:"{\"touser\":\"owG-A4niWetH_dTyowY_gSgbAKzA\",\"msgtype\":\"text\",\"text\":{\"content\":\"\u7231\u7c9f\u88d5\u8985Hi\u597d\u837b\u82b1\u5723\u6bbf\u73af\u7403\u7f51\u597d\u7684\"}}" 

res:{"errcode":40001,"errmsg":"invalid credential, access_token is invalid or not latest hint: [BU_uaa03738886!]"} 




2018-09-13 21:04:28 [5b9a605c90d1b][140.207.54.79][info][wxRequest] 

GET url:https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=13_fgNRFDBRCcehDaGdayppq1FT5Wer6p451KFJ36hzqf22N_aBzLFLWOx_eO1SbEVIE2VP8bwaGFLfcCvXVGG_O-1Hze-pRs-WE84l-r_0doZpYi2oHUmrDKiAEbMRZHhAAAJRZ 

req:"{\"touser\":\"owG-A4hvAWm1270w5MKwg4zG8_kI\",\"msgtype\":\"text\",\"text\":{\"content\":\"\u7231\u7c9f\u88d5\u8985Hi\u597d\u837b\u82b1\u5723\u6bbf\u73af\u7403\u7f51\u597d\u7684\"}}" 

res:{"errcode":40001,"errmsg":"invalid credential, access_token is invalid or not latest hint: [UCi_IA08688877!]"} 






2018-09-13 21:21:03 [5b9a643f0aa5f][140.207.54.76][info][wxRequest] 

GET url:https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=13_fgNRFDBRCcehDaGdayppq1FT5Wer6p451KFJ36hzqf22N_aBzLFLWOx_eO1SbEVIE2VP8bwaGFLfcCvXVGG_O-1Hze-pRs-WE84l-r_0doZpYi2oHUmrDKiAEbMRZHhAAAJRZ 

req:"{\"touser\":\"owG-A4niWetH_dTyowY_gSgbAKzA\",\"msgtype\":\"text\",\"text\":{\"content\":\"test\"}}" 

res:{"errcode":40001,"errmsg":"invalid credential, access_token is invalid or not latest hint: [YCD0.A08638888!]"} 




2018-09-13 21:23:36 [5b9a64d899dea][140.207.54.76][info][wxRequest] 

GET url:https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=13_fgNRFDBRCcehDaGdayppq1FT5Wer6p451KFJ36hzqf22N_aBzLFLWOx_eO1SbEVIE2VP8bwaGFLfcCvXVGG_O-1Hze-pRs-WE84l-r_0doZpYi2oHUmrDKiAEbMRZHhAAAJRZ 

req:"{\"touser\":\"owG-A4niWetH_dTyowY_gSgbAKzA\",\"msgtype\":\"text\",\"text\":{\"content\":\"test\"}}" 

res:{"errcode":40001,"errmsg":"invalid credential, access_token is invalid or not latest hint: [eZ82Fa00168878!]"} 


demo   梦幻花园送体力

最后一次编辑于  2018-09-14  (未经腾讯允许,不得转载)
邀请回答
复制链接收藏投诉关注问题回答

1 个回答

  • 三世羽翾
    三世羽翾
    2018-09-14

    access_token无效原因可能是:

    1、获取的access_token超过5分钟失效

    2、本地存储了access_token,而后台又请求了新的,导致access_token对不上

    2018-09-14
    赞同
    回复 1
    • 迎斌payne.peng
      迎斌payne.peng
      2018-09-14

      你好,感谢回复,

      1. 我们通过后台查询到,能及时获得access_token,我们刷新缓存,但是在使用时,有时有效,有时无效,也同时确认没有申请新的token ,感觉像数据传送是被堵塞一样,一旦更新新的token时,发现又正常,但过了几分钟又复现

      2. 本地有缓存后,做了不再请求新的,已查看日记

      2018-09-14
      回复