@WebServlet("/wxLogin") public class WXLoginServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String backUrl = "http://morning.iok.la/MEILI/callBack";// 回调地址 String url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + AuthUtils.APPID + "&redirect_uri=" + URLEncoder.encode(backUrl) + "&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect"; resp.sendRedirect(url); }
相关分类