步骤1:在页面中先引入如下 JS 文件(支持https):
http://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js
步骤2:在需要使用微信登录的地方实例以下 JS 对象:
var obj = new WxLogin({
self_redirect:true,
id:"login_container",
appid: "",
scope: "",
redirect_uri: "",
state: "",
style: "",
href: ""
});
我的代码是
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>111
<div id="login_container"></div>
</body>
<script src="https://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js"></script>
<script>
var obj = new WxLogin({
self_redirect:true,
id:"login_container",
appid: "wx5b391d70fbc66a2c",
scope: "snsapi_login",
redirect_uri: "https://****/wxlogin/api.php",
state: "",
style: "black",
href: ""
});
</script>
</html>
一直提示Scope 参数错误或没有 Scope 权限,我在公众号后台业务域名,JS接口安全域名和网页授权域名已经写入对应的域名,ip白名单也写了,但是还是报错Scope 参数错误或没有 Scope 权限
这是网站应用的扫码登录,你还在公众号后台配置,没地方可配置