公眾號開發-獲取使用者資訊
微信公眾平臺:https://mp.weixin.qq.com
內部測試的appid REDIRECT_URI(使用者登入連結地址) SECRET祕鑰
APPID = ed
REDIRECT_URI = ed
SCOPE = ed
SECRET = ed
1.獲取使用者code資料 (文件中有此連結)
https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&state=STATE#wechat_redirect
(APPID、REDIRECT_URI 、SCOPE )
獲得CODE = 0618RgVf17UNcz0h1pXf1PVbVf18RgVR
2.獲取使用者refresh_token
https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code
(SECRET 、CODE)
3.再次獲取使用者access_token openid
https://api.weixin.qq.com/sns/oauth2/refresh_token?appid=APPID&grant_type=refresh_token&refresh_token=REFRESH_TOKEN
(appid、refresh_token)
4.獲取使用者資訊
https://api.weixin.qq.com/sns/userinfo?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN
(access_token、openid)