微信 公众号 网页授权登录(静默授权)
前提
- 需要在[微信公众平台](https://mp.weixin.qq.com/)注册账号
- 服务号需要微信认证 否者接口权限无法使用
![认真前](https://i-blog.csdnimg.cn/blog_migrate/de8995f4eedf21c5316ca340ae717a9d.png)
![认证后](https://i-blog.csdnimg.cn/blog_migrate/dafa395be824f2052787c01c7a3ee460.png)
配置
- 设置与开发 - 公众号设置 - 网页授权域名
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/300368e53c42249744b94e20e0b96b16.png)
将txt文件放在项目根目录上 - 调用
cope为snsapi_base 静默授权 获取openID 无法获取用户信息
https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx520c15f417810387&redirect_uri=https%3A%2F%2Fchong.qq.com%2Fphp%2Findex.php%3Fd%3D%26c%3DwxAdapter%26m%3DmobileDeal%26showwxpaytitle%3D1%26vb2ctag%3D4_2030_5_1194_60&response_type=code&scope=snsapi_base&state=123#wechat_redirect
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