公众号授权给第三方平台的技术实现流程概览
推送component_verify_ticket协议
在第三方平台创建审核通过后,微信服务器会向其“授权事件接收URL”每隔10分钟定时推送component_verify_ticket。第三方平台方在收到ticket推送后也需进行解密),接收到后必须直接返回字符串success。
web层代码如下:
/**
* 授权事件接收
*
* @param request
* @param response
*/
@RequestMapping(value = "/wechat/auth")
@ResponseBody
public void acceptAuthorizeEvent(HttpServletRequest request, HttpServletResponse response)
throws IOException, AesException {
response.getWriter().print("success");
WxThirdPartyAuthUtil.processAuthorizeEvent(request);
}
WxThirdPartyAuthUtil类的相关代码:
/**
* 处理授权事件的推送
*
* @param request
* @throws IOException
* @throws AesException
* @throws DocumentException
*/
public static void processAuthorizeEvent(HttpServletRequest request) throws IOExcep