After 24:00 on October 25, 2022, the WeChat applet can no longer directly obtain the user's WeChat profile picture and nickname through authorization; in order to protect user privacy, the ability to fill in the profile picture nickname has been changed, and the process of obtaining the profile picture nickname has become more complicated .
How to use the avatar nickname after obtaining the revised version
Avatar selection
The value of the button component needs to open-type
be set to chooseAvatar
, after the user selects the avatar to be used, bindchooseavatar
the temporary path to the avatar information can be obtained through the event callback.
Starting from version 2.24.4 of the basic library, if the image uploaded by the user fails the security inspection, bindchooseavatar
the event will not be triggered.
Fill in nickname
The value of the input component needs to type
be set to nickname
, when the user enters this input, the WeChat nickname will be displayed above the keyboard.
Starting from version 2.24.4 of the basic library, when onBlur
an event is triggered, WeChat will asynchronously monitor the security of the content entered by the user. If the security monitoring fails, WeChat will clear the content entered by the user. It is recommended that developers use the button component in the form Collect user input.form-type
submit
Adjustment instructions
After 24:00 on October 25, 2022 (hereinafter collectively referred to as the "effective date"), the rules for obtaining user avatar nicknames will be adjusted as follows:
- From the effective date, the Mini Program wx.getUserProfile interface will be withdrawn : for new versions of the Mini Program released after the effective date, the user avatar obtained through the wx.getUserProfile interface will uniformly return the default gray profile picture , and the nickname will uniformly return "WeChat user". Mini Program versions released before the effective date will not be affected, but adaptations are required for version updates.
- From the effective date, the plug-in obtains the user nickname and avatar through the wx.getUserInfo interface will be withdrawn : for the new version of the plug-in released after the effective date, the user avatar obtained through the wx.getUserInfo interface will uniformly return the default gray avatar , and the nickname will uniformly return "WeChat user ". The plug-in version released before the effective date will not be affected, but if the version is to be updated, it needs to be adapted. The ability to obtain openId and unionId through wx.login and wx.getUserInfo interfaces will not be affected.
- "Avatar nickname filling ability" supports obtaining user avatar nicknames : If the business needs to obtain user avatar nicknames, you can use " Avatar nickname filling ability " (supported from version 2.21.2 of the basic library, covering iOS and Android WeChat versions 8.0.16 and above), The specific practices can be found in the "Best Practices" below.
- The applet wx.getUserProfile and the plug-in wx.getUserInfo interface are compatible with the avatar and nickname acquisition requirements of the base library version 2.27.1 and below : for access from the base library and WeChat client of a lower version, the applet will normally return the user avatar through the wx.getUserProfile interface Nickname, the plug-in will normally return the user avatar nickname through the wx.getUserInfo interface, and developers can continue to use the above capabilities for backward compatibility.
For the above 3, the detailed comparison of the basic library version support capabilities of the wx.getUserProfile interface, wx.getUserInfo interface, and avatar nickname filling capabilities is shown in the table below:
*For low-version basic libraries, please refer to the compatibility documents for compatibility processing