开发文档参考链接:https://mp.weixin.qq.com/wiki?t = resources / status_main&id = mp1421141115
1 配置本地nginx
server {
listen 80;
server_name localhost;
root 代码路径;
index index.html index.htm;
location /rest {
proxy_pass 访问接口配置;
proxy_set_header Host $http_host;
proxy_set_header X-Forward-For $remote_addr;
}
}
注意监听端口一定只能是80;
2 修改本机主机,修改域名指向本地
修改C:\ Windows \ System32 \ drivers \ etc \ host.ics文件,配置localhost指向
127.0.0.1域名(该域名为公众号里边配置的域名)
也可以使用switchhost来做
3 使用网页授权URL
参考链接(请在微信客户端中打开此链接体验):
scope为snsapi_base
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
4 获取openid(必须)
通过后台接口调用
5 获取wx配置
通过后台接口调用返回
配置报错,参考该链接校验:https://www.cnblogs.com/ka-bu-qi-nuo/p/8659688.html