微信第三方平台公众号授权流程4-pre_auth_code

该API用于获取预授权码。预授权码用于公众号或小程序授权时的第三方平台方安全验证。
web层代码如下:

/**
	 * 授权回调
	 * @param resp
	 */
	@RequestMapping(value = "/wechat/redirectAuthPage")
	@ResponseBody
	public void redirectAuthPage(HttpServletRequest request,HttpServletResponse resp) throws IOException {
		resp.sendRedirect(WxThirdPartyAuthUtil.getRedirectAuthUrl(request));
	}

WxThirdPartyAuthUtil类相关代码:

/**
	 * 获取第三方回调授权地址
	 * @param request 
	 * @return
	 */
	public static String getRedirectAuthUrl(HttpServletRequest request){
		String url="";
		try {
			url = "https://mp.weixin.qq.com/cgi-bin/componentloginpage?"
					+ "component_appid=%s&pre_auth_code=%s&redirect_uri=%s";
			url = String.format(url, component_appid,WxThirdPartyAuthUtil.getPreAuthCode(),
					URLEncoder.encode(UrlUtil.getDomainWithContext(request)+"/wechat/$APPID$/callback", "utf-8"));
			LOGGER.error("第三方回调授权地址"+url);
		} catch (UnsupportedEncodingException e) {
			LOGGER.error(e.toString());
		}