一、背景说明
微信公众号配置及api调用可通过三方平台进行扫码授权配置,由三方平台代调用api,减少业务平台配置操作,减少公众号主体客户方操作流程
二、配置流程
(1)三方平台应用登录创建
微信开放平台地址
https://open.weixin.qq.com/
(2)主要配置信息
域名配置: **.com
授权事件接收配置: https://**/unauth/wechat/platform/event
消息与事件接收配置: https://**/unauth/wechat/platform/msg/$APPID$/callback
(3)核心逻辑
1、平台配置是授权集信息,生成授权码链接---用于商家扫码接口授权
2、微信平台推送票据Ticket
3、根据平台 appid和ticket secreat 获取平台component_access_token
4、根据平台appid和component_access_token 获取预授权码 pre_auth_code
5、授权后存储学校信息及商家appid信息
6、获得pre_auth_code后,按照授权技术流程说明文档 ,引导用户授权后获取authorization_code
https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid=xxxx&pre_auth_code=xxxxx&redirect_uri=xxxx&auth_type=xxx
目前是跳转到前端获取后再调用后台接口
bindWechatThirdAuth(String platformCode, String authorizationCode)
7、获得authorization_code后,按照使用授权码换取公众号或小程序的接口调用凭据和授权信息 接口文档 ,调接口获取authorizer_refresh_token
8、获得authorizer_refresh_token后,按照获取/刷新授权公众号或小程序的接口调用凭据 接口文档 ,调接口获取authorizer_access_token
9、根据 获取商家authorizer_access_token
10、authorizer_access_token 获取授权token并缓存