这个接口获取到的 accessToken ,不能进行其他接口的调用,如下,不能调用获取模板列表的接口, 提示无权限,
https://api.weixin.qq.com/cgi-bin/stable_token 获取到的 access token 不可以调用 获取模板列表接口:https://api.weixin.qq.com/cgi-bin/template/get_all_private_template?access_token= , 返回错误信息: {"errcode":48001,"errmsg":"api unauthorized rid: 66e5c46f-52840e51-094bb310"}
2024-09-15 00:09:33,965 [8ff4afe5c0649af6] [http-nio-8080-exec-4] INFO com.msb.notice.jpush.utils.OkHttpUtil 93 doPostJson 请求url地址:https://api.weixin.qq.com/cgi-bin/stable_token,请求参数:{"grant_type":"client_credential","appid":"xxxx","secret":"bbbb","force_refresh":false}
2024-09-15 00:09:34,640 [8ff4afe5c0649af6] [http-nio-8080-exec-4] INFO com.msb.notice.jpush.utils.OkHttpUtil 136 addResponseLog [https://api.weixin.qq.com/cgi-bin/stable_token]地址->请求完成,响应结果:{"access_token":"84_vWP_BMIMQ02VxmoiYg9tF0QOXAn06xXFjK91RJiWnEsrLZEU11i4jAfNNINgLJ-1uQwcgzk01_NDF-0dbYpZoagZSvKt5BAxRPMaoujD7YrLblPmafqQFg1FipEGQIgAJAZJB","expires_in":7200},response:200 OK, 耗时:675 ms
2024-09-15 01:05:04,459 [] [ConsumeMessageThread_3] INFO com.msb.notice.weixin.utils.HttpClientUtil 24 doGet <<<<================ url: https://api.weixin.qq.com/cgi-bin/template/get_all_private_template?access_token=84_vWP_BMIMQ02VxmoiYg9tF0QOXAn06xXFjK91RJiWnEsrLZEU11i4jAfNNINgLJ-1uQwcgzk01_NDF-0dbYpZoagZSvKt5BAxRPMaoujD7YrLblPmafqQFg1FipEGQIgAJAZJB
2024-09-15 01:05:04,670 [] [ConsumeMessageThread_3] INFO com.msb.notice.weixin.utils.HttpClientUtil 48 doGet ================>>>> responseStr: {"errcode":48001,"errmsg":"api unauthorized rid: 66e5c240-2ac60a43-0a51963f"}
------------
但是 https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential 这个接口获取到的token 就正常。
2024-09-15 01:33:41,869 [] [ConsumeMessageThread_4] INFO com.msb.notice.weixin.utils.HttpClientUtil 24 doGet <<<<================ url: https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=xxxx&secret=bbbb
2024-09-15 01:33:41,869 [] [ConsumeMessageThread_3] INFO com.msb.notice.weixin.utils.HttpClientUtil 24 doGet <<<<================ url: https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=xxxx&secret=00d8db613bcb647be9d8fc7cbdacf74a
2024-09-15 01:33:42,643 [] [ConsumeMessageThread_3] INFO com.msb.notice.weixin.utils.HttpClientUtil 48 doGet ================>>>> responseStr: {"access_token":"84_VDjRnw5OLpkw0dJNi0WwtEpWy2yZR1yQAyBmyDFxcSmvsPDqg9aU4-WH92cQkNwCAh2fbWLqy9MvE8iM7zqahsoyrFagosy1SmfkhtTAamUKQ1aZn7fUZNl030QAAZjACANNM","expires_in":7200}
2024-09-15 01:33:43,415 [] [ConsumeMessageThread_3] INFO com.msb.notice.weixin.utils.HttpClientUtil 24 doGet <<<<================ url: https://api.weixin.qq.com/cgi-bin/template/get_all_private_template?access_token=84_VDjRnw5OLpkw0dJNi0WwtEpWy2yZR1yQAyBmyDFxcSmvsPDqg9aU4-WH92cQkNwCAh2fbWLqy9MvE8iM7zqahsoyrFagosy1SmfkhtTAamUKQ1aZn7fUZNl030QAAZjACANNM
2024-09-15 01:33:43,709 [] [ConsumeMessageThread_3] INFO com.msb.notice.weixin.utils.HttpClientUtil 48 doGet ================>>>> responseStr: {"template_list":[{"template_id":"KP_6fCfieaw75VVU12YAqSiPegXICbYmYL8xLPfKJ6c","title":"排课通知","primary_industry":"","deputy_industry":"","content":"{{first.DATA}} 已排课程:{{keyword1.DATA}} 上课时间:{{keyword2.DATA}} {{remark.DATA}}","example":""},{"template_id":"7WsnJIB7_CgdKGQW0IVqzbypvz9gpXNcZvW6t5FBcFg","title":"教师课前提醒","primary_industry":"","deputy_industry":"","content":"{{first.DATA}} \n课程名称:{{keyword1.DATA}} \n上课时间:{{keyword2.DATA}} \n上课地点:{{keyword3.DATA}} \n联系电话:{{keyword4.DATA}} \n{{remark.DATA}}","example":""},{"template_id":"-vu4aCvOXWZZPzUmVd9jhr-wi_b2ompt8uqLalL6IuA","title":"实习期考核秘钥","primary_industry":"","deputy_industry":"","content":"{{first.DATA}}\n预约验证码:{{keyword1.DATA}}\n预约名字:{{keyword2.DATA}}\n考试日期:{{keyword3.DATA}}\n考试场次:{{keyword4.DATA}}\n{{remark.DATA}}","example":""},{"template_id":"BCKzIkrP1XXIS6yd0wmqCQdT9d-LITQ8eMHsLZ5SH4Y","title":"审核结果通知","primary_industry":"","deputy_industry":"","content":"{{first.DATA}}\n姓名:{{keyword1.DATA}}\n日期:{{keyword2.DATA}}\n审核反馈:{{keyword3.DATA}}\n温馨提示:{{keyword4.DATA}}","example":""},{"template_id":"7GBSEFPOHjrP9xvGrKh6h_-ndvTvhFhQ724sKXPKXDc","title":"审核结果通知","primary_industry":"","deputy_industry":"","content":"{{first.DATA}}\n类型:{{keyword1.DATA}}\n状态:{{keyword2.DATA}}\n处理时间:{{keyword3.DATA}}\n{{remark.DATA}}","example":""},{"template_id":"nOutoPjSnbOAMRCSiL6Z8ab2ROL6gn-LCqDyxbTU8Xw","title":"教师通知","primary_industry":"","deputy_industry":"","content":"{{first.DATA}}\n通知类型:{{keyword1.DATA}}\n通知内容:{{keyword2.DATA}}\n{{remark.DATA}}","example":""},{"template_id":"8mZwDWpwOIMMSUoQwLePXjbBD-XmmMsdw8sUFJ8jVv0","title":"请假审核通知","primary_industry":"","deputy_industry":"","content":"{{first.DATA}} \n请假老师:{{keyword1.DATA}} \n请假类型:{{keyword2.DATA}} \n请假时间:{{keyword3.DATA}} \n请假事由:{{keyword4.DATA}} \n备注:{{remark.DATA}}","example":""},{"template_id":"iCVerbxQFToyah49NB_KRF0rkklP27EepYNCfdDjkzs","title":"排课通知","primary_industry":"","deputy_industry":"","content":"{{first.DATA}}\n学员:{{keyword1.DATA}}\n时间:{{keyword2.DATA}}\n课程:{{keyword3.DATA}}\n教师:{{keyword4.DATA}}\n备注:{{keyword5.DATA}}\n{{remark.DATA}}","example":""},{"template_id":"fv2L3kdJ6Aw9gDELox61QokIyIf3TrYxPD-AaWoo_i4","title":"员工通知-黄春","primary_industry":"","deputy_industry":"","content":"{{first.DATA}}\n通知名称:{{keyword1.DATA}}\n通知编号:{{keyword2.DATA}}\n通知摘要:{{keyword3.DATA}}\n{{remark.DATA}}","example":""},{"template_id":"n38lNKV0NpDn4F-eGRD0NlV0db6hPWJncoodgv8xk_w","title":"备课提醒","primary_industry":"","deputy_industry":"","content":"{{first.DATA}} \n通知类型:{{keyword1.DATA}} \n通知内容:{{keyword2.DATA}}","example":""}]}
请问是什么情况?
文档中的描述没有提示说有类似的问题
获取稳定版接口调用凭据
接口说明
接口英文名
getStableAccessToken
功能描述
- 获取公众号全局后台接口调用凭据,有效期最长为7200s,开发者需要进行妥善保存;
- 有两种调用模式: 1. 普通模式,
access_token
有效期内重复调用该接口不会更新access_token
,绝大部分场景下使用该模式;2. 强制刷新模式,会导致上次获取的access_token
失效,并返回新的access_token
; - 该接口调用频率限制为 1万次 每分钟,每天限制调用 50w 次;
- 与获取Access token获取的调用凭证完全隔离,互不影响。该接口仅支持
POST JSON
形式的调用
你好,因为认证过期,需要接口权限。详细请参考文档:https://developers.weixin.qq.com/doc/offiaccount/Getting_Started/Explanation_of_interface_privileges.html
接口返回的报错,并不是token返回的报错