微信网页授权登录
微信网页授权登录
- 在微信开放平台的网站应用中配置 回调域名
- 注:回调域名不用写http,https. xxxxx.com || xxxx.cn
- 页面引入
<script src="http://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js"></script>
- 在需要使用登录的地方
new window.WxLogin({ self_redirect:true, id: "login_container", appid: "", scope: "snsapi_login", // snsapi_base(无感) snsapi_snsuserinfo(需要用户同意) redirect_uri: encodeURIComponent('此处链接是回调域名下的路径'), state: "", style: "", href: "" //为一个css文件的地址,或直接对CSS进行base64加密:格式:href: "data:text/css;base64,base64加密后的字符串" });