用户同意授权,获取code
先将 链接拼接编译
scope为snsapi_userinfo
https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxf0e81c3bee622d60&redirect_uri=http%3A%2F%2Fnba.bluewebgame.com%2Foauth_response.php&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect
<body>
<a onclick="dianji()">点击</a>
</body>
</html>
<script src="Scripts/jquery-3.4.1.min.js"></script>
<script>
//点击调用此方法
function dianji() {
//拼接跳转链接
var dz = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxf0e81c3bee622d60&redirect_uri=";
//编译Url
var REDIRECT_URI = encodeURIComponent("http://nba.bluewebgame.com");
var dzq="&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect"
//拼接后的链接
var url = dz + REDIRECT_URI + dzq;
//跳转此链接
}
</script>
编写后 将此代码用浏览器 并使用F12键 将url的值输出出来 将输出后的链接使用 微信WEB开发者工具打开 运行此链接后得到下图展现的效果 授权获取COde则获取成功

让我们一起来学习C#吧~~~
浙公网安备 33010602011771号