用户关注公众后,从回调中能拿到openId,再根据openId调用获取用户信息的接口(https://api.weixin.qq.com/cgi-bin/user/info?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN),也只能拿到unionId,nickname和headimgurl返回的都是空字符串,现在要怎么获取用户头像和昵称呢?
用户关注公众号后,怎么获取用户信息?After users follow the official account, how to obtain user information?
用户关注公众号后,怎么获取用户信息?用户关注公众后,从回调中能拿到openId,再根据openId调用获取用户信息的接口(https://api.weixin.qq.com/cgi-bin/user/info?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN),也只能拿到unionId,nickname和headimgurl返回的都是空字符串,现在要怎么获取用户头像和昵称呢?
After paying attention to the public, the user can get openid from the callback, and then call the interface to obtain user information according to openid( https://api.weixin.qq.com/cgi-bin/user/info?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN ), you can only get unionid. Nickname and headimgurl return empty strings. Now how do you get the user's Avatar and nickname?
回答:
目前只能通过用户授权获取。
原文出处:用户关注公众号后,怎么获取用户信息?
走网页授权路线。
https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_webpage_authorization.html#3