In the project, you need to obtain the WeChat user's avatar and nickname. If the nickname and avatar URL are saved in the database, the information will not be updated in time, and the original URL will become invalid after changing the avatar. Should I download the avatar locally? What if other methods are used? Which method is more reasonable?
H5 local storage
Each OpenID used is unique and needs to be stored in the database. The avatar nickname may change and the expiration time of the stored session setting is changed. Personal opinion
Be sure to save the database, including openid. If you have high requirements for updating your WeChat username and avatar, make scheduled tasks to update them regularly.
If you only need to update the avatar, access the avatar address regularly. If it does not exist, call the interface to query WeChat user information and update the database.
I also encountered this problem. When logging in with WeChat, the avatar of the WeChat user is captured, but what should I do if the user changes the avatar?