执行流程:
url2,用户授权获取code,这个code会跟在redirect_uri=url1后面,有用户发送到业务系统,业务系统拿到code后,可以获取用户openId.
https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&state=STATE#wechat_redirect
url3,拿到code后,向微信服务器发送请求,可以获取openId和access_token
https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code
拿到openId和access_token后可以获取用户的详细信息
https://api.weixin.qq.com/sns/userinfo?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN
转载: https://blog.csdn.net/u014225427/article/details/54926781