ext_wechatOpenAuth.ext.jsp 825 B

123456789101112131415
  1. <%@ page language="java" import="base.SsC" pageEncoding="UTF-8"%>
  2. <%@ page import="base.WechatC" %>
  3. <html>
  4. <head>
  5. </head>
  6. <body>
  7. <script>
  8. //下面url是发起授权的url,其中参数scope是是否需要用户授权确认的意思,有两个选项,scope=snsapi_base表示静默,scope=snsapi_userinfo表示弹出让用户授权的窗口
  9. //下面的redirect_uri就是,浏览器跳到下面url地址的微信页面后,浏览器会重定向(跳到)的新地址
  10. window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid="+ <%=WechatC.WECHAT_appId%> +
  11. "&redirect_uri=http://localhost:8080/extRoot?type=${type}&token=${token}"+ <%-- 这里的 &token= 就是 token,不是 &ssToken=。Lin --%>
  12. "&response_type=code&scope=snsapi_base&state=123#wechat_redirect";
  13. </script>
  14. </body>
  15. </html>