公众号和小程序已经绑定到开放平台下,但是获取到的unionid为什么不一致呢?
目前开放平台下有个公众号应用和小程序应用: 公众号APPID:wxead7772cfb6024c5 小程序APPID:wx6a4531b6d99c40a7 目前按照网页授权方式(官方文档:https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_webpage_authorization.html)拉取用户信息(/sns/userinfo)获取到的unionid和小程序端为什么不一致,最好官方帮忙查查?在线等。 公众号用户通过网页授权获取到的:openid=oc_EpwYOA55f6GfSQE6-X2mgu9DA,获取到的unionid=o2X0QwMbaBsypg9t3BSDujUJWnwo 小程序通过调用wx.getUserInfo,获取encryptedData字段解密的openid=ocFoh5ck60LxviYfS_jLJWZJuQyw,unionid=o7HDevu3AyzwsYRV0ctKnxcP-kIk 网页授权部分日志: [2020-05-06 16:19:29][DEBUG] =================2020-05-06 16:19:29================= [2020-05-06 16:19:29][INFO] getWXCode url: https://api.weixin.qq.com/sns/oauth2/access_token [2020-05-06 16:19:29][INFO] getWXCode params: {"appid":"wxead7772cfb6024c5","secret":"*********敏感数据隐藏*******","code":"081QJfSG1oZMj30ihAPG14trSG1QJfSW","grant_type":"authorization_code"} [2020-05-06 16:19:29][INFO] getWXCode result: "{\"access_token\":\"33_9kSGnOR-HV-ZLSOROD3DTNpajPsec-f0ZfDLT6nS3_bRSblzWo4cT4MmGW5-hLcqZhhF5ja9H3WjwA7mX3FPWw\",\"expires_in\":7200,\"refresh_token\":\"33_TKGgZSZjWPnHPeXizjJUqwkF5d9pCV5wLo1mPZ__4jcE_luogl_D7K8ngxR8SYPk6Q4rMWDtdGLEWY4q3sp7FA\",\"openid\":\"oc_EpwYOA55f6GfSQE6-X2mgu9DA\",\"scope\":\"snsapi_base\"}" [2020-05-06 16:19:29][DEBUG] [2020-05-06 16:19:29][DEBUG] [2020-05-06 16:19:29][DEBUG] =================2020-05-06 16:19:29================= [2020-05-06 16:19:29][INFO] getWXCode url: https://api.weixin.qq.com/sns/userinfo [2020-05-06 16:19:29][INFO] getWXCode params: {"access_token":"33_9kSGnOR-HV-ZLSOROD3DTNpajPsec-f0ZfDLT6nS3_bRSblzWo4cT4MmGW5-hLcqZhhF5ja9H3WjwA7mX3FPWw","openid":"oc_EpwYOA55f6GfSQE6-X2mgu9DA","lang":"zh_CN"} [2020-05-06 16:19:29][INFO] getWXCode result: "{\"openid\":\"oc_EpwYOA55f6GfSQE6-X2mgu9DA\",\"nickname\":\"\u5b50\u6708\u521d\",\"sex\":1,\"language\":\"zh_CN\",\"city\":\"\",\"province\":\"\",\"country\":\"\u4e2d\u56fd\",\"headimgurl\":\"http:\\\/\\\/thirdwx.qlogo.cn\\\/mmopen\\\/vi_32\\\/Q0j4TwGTfTIkw0edicQAvJtWOYAXGV4AIJibwHEJeq0O32SMzZuNrHINNYB1Ztic3m1HCFff4LpRHIVPb02A7sGpg\\\/132\",\"privilege\":[],\"unionid\":\"o2X0QwMbaBsypg9t3BSDujUJWnwo\"}" [2020-05-06 16:19:29][DEBUG] [2020-05-06 16:19:29][DEBUG] [2020-05-06 16:19:29][DEBUG] =================2020-05-06 16:19:29================= [2020-05-06 16:19:29][INFO] params: {"code":"081QJfSG1oZMj30ihAPG14trSG1QJfSW","openId":"oc_EpwYOA55f6GfSQE6-X2mgu9DA","basicAccessToken":"33_bhC18_rF8bvJav0uh9EBWYb-p1PPXeRGlVDyCuWXV89qtPH2zr1Fx6lV4eYLtA4xoUhAxbg0NTaVGxYgTbvxv0v0aDkBj3DWm-D1zVF89kTuyd8TEiAuCfuYkfYYkmrITo2rFqq7G7zquGWgYPUcAHACTY","loginAccessToken":"33_9kSGnOR-HV-ZLSOROD3DTNpajPsec-f0ZfDLT6nS3_bRSblzWo4cT4MmGW5-hLcqZhhF5ja9H3WjwA7mX3FPWw"} [2020-05-06 16:19:29][DEBUG]